├── MyAnimeList
├── anime_database.db
├── requirements.txt
├── README.md
├── database.py
└── scraper.py
├── IGDTUW
├── requirements.txt
├── README.md
└── main.py
├── scrap_flipkart
├── requirements.txt
├── README.MD
└── script.py
├── MLH
├── requirements.txt
├── README.md
└── main.py
├── Devpost
├── requirements.txt
├── README.md
└── main.py
├── scrape_countries_population
├── requirements.txt
├── README.md
└── script.py
├── News Laundry
├── requirements.txt
├── README.md
└── main.py
├── Get recipe from ingredients
├── requirements.txt
├── README.md
└── main.py
├── Wynk Music Scraper
├── requirements.txt
├── README.md
└── music.py
├── Youtube
├── requirements.txt
├── README.md
└── main.py
├── unstop
├── requirements.txt
├── README.md
└── UNSTOP.py
├── Devfolio
├── requirements.txt
├── README.md
└── main.py
├── Libgen
├── requirements.txt
├── README.md
├── libgen.py
├── libgen.js
├── libgen.ts
└── libgen.go
├── assets
└── tan.jpg
├── Medium
├── image.png
├── image-1.png
├── requirements.txt
├── README.md
├── medium.py
└── Data.txt
├── Github Education
├── requirements.txt
├── README.md
└── main.py
├── GFG
├── requirements.txt
├── README.md
└── scraper.py
├── Instagram
├── go.mod
├── README.md
└── main.go
├── .gitignore
├── Dockerfile
├── .github
└── workflows
│ ├── greetings.yml
│ ├── label.yml
│ ├── stale.yml
│ └── python-publish.yml
├── Internshala
├── README.md
└── internshala.js
├── CONTRIBUTING.md
├── README.md
└── LICENSE
/MyAnimeList/anime_database.db:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/IGDTUW/requirements.txt:
--------------------------------------------------------------------------------
1 | requests
2 | lxml
3 |
--------------------------------------------------------------------------------
/scrap_flipkart/requirements.txt:
--------------------------------------------------------------------------------
1 | requests
2 | lxml
--------------------------------------------------------------------------------
/MLH/requirements.txt:
--------------------------------------------------------------------------------
1 | selenium
2 | requests
3 | pymongo
--------------------------------------------------------------------------------
/Devpost/requirements.txt:
--------------------------------------------------------------------------------
1 | selenium
2 | requests
3 | pymongo
4 |
--------------------------------------------------------------------------------
/scrape_countries_population/requirements.txt:
--------------------------------------------------------------------------------
1 | requests
2 | lxml
--------------------------------------------------------------------------------
/News Laundry/requirements.txt:
--------------------------------------------------------------------------------
1 | selenium
2 | requests
3 | pymongo
4 |
--------------------------------------------------------------------------------
/Get recipe from ingredients/requirements.txt:
--------------------------------------------------------------------------------
1 | selenium
2 | requests
3 |
--------------------------------------------------------------------------------
/MyAnimeList/requirements.txt:
--------------------------------------------------------------------------------
1 | beautifulsoup4==4.9.3
2 | requests==2.31.0
--------------------------------------------------------------------------------
/Wynk Music Scraper/requirements.txt:
--------------------------------------------------------------------------------
1 | selenium
2 | requests
3 | pymongo
4 |
--------------------------------------------------------------------------------
/Youtube/requirements.txt:
--------------------------------------------------------------------------------
1 | beautifulSoup
2 | selenium
3 | lxml
4 | pandas
--------------------------------------------------------------------------------
/unstop/requirements.txt:
--------------------------------------------------------------------------------
1 | pymongo
2 | time
3 | selenium
4 | requests
5 |
--------------------------------------------------------------------------------
/Devfolio/requirements.txt:
--------------------------------------------------------------------------------
1 | aiohttp
2 | asyncio
3 | lxml
4 | pymongo
5 |
--------------------------------------------------------------------------------
/Libgen/requirements.txt:
--------------------------------------------------------------------------------
1 | requests
2 | beautifulsoup
3 | json
4 | logging
5 |
--------------------------------------------------------------------------------
/assets/tan.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anupammaurya6767/web_scrapper/HEAD/assets/tan.jpg
--------------------------------------------------------------------------------
/Medium/image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anupammaurya6767/web_scrapper/HEAD/Medium/image.png
--------------------------------------------------------------------------------
/Github Education/requirements.txt:
--------------------------------------------------------------------------------
1 | beautifulsoup4==4.9.3
2 | pymongo==3.11.6
3 | requests==2.31.0
4 |
--------------------------------------------------------------------------------
/Medium/image-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anupammaurya6767/web_scrapper/HEAD/Medium/image-1.png
--------------------------------------------------------------------------------
/GFG/requirements.txt:
--------------------------------------------------------------------------------
1 | requests==2.31.0
2 | beautifulsoup4==4.11.1
3 | selenium==4.9.1
4 | webdriver_manager
--------------------------------------------------------------------------------
/Medium/requirements.txt:
--------------------------------------------------------------------------------
1 | requests==2.31.0
2 | beautifulsoup4==4.11.1
3 | selenium==4.9.1
4 | webdriver_manager
--------------------------------------------------------------------------------
/Instagram/go.mod:
--------------------------------------------------------------------------------
1 | module Instagram
2 |
3 | go 1.16
4 |
5 | require (
6 | github.com/sclevine/agouti v1.13.0
7 | )
8 |
9 |
--------------------------------------------------------------------------------
/Instagram/README.md:
--------------------------------------------------------------------------------
1 | # 🌟 Instagram User Details Scraper 🌟
2 |
3 | This go script allows you to scrape Instagram user details such as the number of posts, followers, and following for a given username.
4 |
5 |
--------------------------------------------------------------------------------
/Libgen/README.md:
--------------------------------------------------------------------------------
1 | # My Awesome Repository
2 |
3 | Welcome to my awesome repository! This repository contains scripts written in various programming languages for scraping data from Library Genesis.
4 |
5 | ## Languages Used
6 |
7 | - JavaScript
8 | - Go
--------------------------------------------------------------------------------
/Youtube/README.md:
--------------------------------------------------------------------------------
1 | ## Youtube Channels informations
2 |
3 | This Python script allows users to get a overview of recent videos uploaded by a youtube channel.User just has to input a youtube channel name
4 | where it will get "Videos Title" ,"Views" and "Likes" of recently uploaded videos in a csv file.It uses selenium,BeautifulSoup and pandas
5 |
6 | ## Prerequisites
7 |
8 | 1.Selenium
9 | 2.BeautifulSoup
10 | 3.lxml
11 | 4.pandas
12 |
--------------------------------------------------------------------------------
/scrap_flipkart/README.MD:
--------------------------------------------------------------------------------
1 | ## Scrap_Flipkart
2 | This Python script allows you to scrape data from FLIPKART website ,relevant information such as the "Product name" "Produce price","Description","Reviews" It uses the `requests` library to make HTTP requests and `lxml` for HTML parsing.
3 |
4 | ## Prerequisites
5 |
6 | Before using this script, ensure you have the following dependencies installed in your Python environment:
7 |
8 | - pandas
9 | - BeautifulSoup
10 | -lxml
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Build and Release Folders
2 | bin-debug/
3 | bin-release/
4 | [Oo]bj/
5 | [Bb]in/
6 |
7 | # Other files and folders
8 | .settings/
9 |
10 | # Executables
11 | *.swf
12 | *.air
13 | *.ipa
14 | *.apk
15 |
16 | # MacOS
17 | .DS_Store
18 |
19 | # Project files, i.e. `.project`, `.actionScriptProperties` and `.flexProperties`
20 | # should NOT be excluded as they contain compiler settings and other important
21 | # information for Eclipse / Flash Builder.
22 |
--------------------------------------------------------------------------------
/scrape_countries_population/README.md:
--------------------------------------------------------------------------------
1 | ## scrape countries population
2 | This Python script allows you to scrape data from world population record,relevant information such as the "Countries name" "population". It uses the `requests` library to make HTTP requests and `lxml` for HTML parsing.
3 |
4 | ## Prerequisites
5 |
6 | Before using this script, ensure you have the following dependencies installed in your Python environment:
7 |
8 | - pandas
9 | - BeautifulSoup
10 | -lxml
--------------------------------------------------------------------------------
/IGDTUW/README.md:
--------------------------------------------------------------------------------
1 | # IGDTUW Notice Scrapper
2 |
3 | This Python script allows you to scrape notices data from the IGDTUW website and extract relevant information such as the "title of notice," "link." It uses the `requests` library to make HTTP requests and `lxml` for HTML parsing.
4 |
5 | ## Prerequisites
6 |
7 | Before using this script, ensure you have the following dependencies installed in your Python environment:
8 |
9 | - Python 3.x
10 | - requests library
11 | - lxml library
12 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM ubuntu:18.04
2 |
3 |
4 | FROM python:3.7
5 |
6 | RUN apt-get update
7 |
8 | # Make python 3.7 the default
9 | RUN echo "alias python=python3.7" >> ~/.bashrc
10 | RUN export PATH=${PATH}:/usr/bin/python3.7
11 | RUN /bin/bash -c "source ~/.bashrc"
12 |
13 | # Install pip
14 | RUN apt-get install -y python3-pip && \
15 | python -m pip install --upgrade pip && \
16 | python -m pip install -r requirements.txt
17 |
18 | WORKDIR /usr/app/src
19 |
20 | COPY . .
21 |
22 | CMD ["python", "sample.py"]
23 |
--------------------------------------------------------------------------------
/.github/workflows/greetings.yml:
--------------------------------------------------------------------------------
1 | name: Greetings
2 |
3 | on: [pull_request_target, issues]
4 |
5 | jobs:
6 | greeting:
7 | runs-on: ubuntu-latest
8 | permissions:
9 | issues: write
10 | pull-requests: write
11 | steps:
12 | - uses: actions/first-interaction@v1
13 | with:
14 | repo-token: ${{ secrets.GITHUB_TOKEN }}
15 | issue-message: "Thank you for opening this issue! Your contribution to our project is much appreciated."
16 | pr-message: "Thank you for your pull request!"
17 |
--------------------------------------------------------------------------------
/GFG/README.md:
--------------------------------------------------------------------------------
1 | # GeeksforGeeks Scraper
2 |
3 | ## Overview
4 |
5 | This Python script scrapes various types of courses from GeeksforGeeks , stores it in a SQL database . It provides information such as Name , Price , Rating wtc . This README provides instructions for setting up and using the script.
6 |
7 | ## Prerequisites
8 |
9 | Before using this script, ensure that you have the following installed:
10 |
11 | - Python 3.x
12 | - `pip` package manager
13 | - MySQL
14 | - Required Python packages (install using `pip install -r requirements.txt`)
--------------------------------------------------------------------------------
/Devfolio/README.md:
--------------------------------------------------------------------------------
1 | # Devfolio Hackathon Data Scraper
2 |
3 | This Python script allows you to scrape hackathon data from the Devfolio website and extract relevant information such as the "title," "link," "mode of participation," and "Date." It uses the `requests` library to make HTTP requests and `lxml` for HTML parsing.
4 |
5 | ## Prerequisites
6 |
7 | Before using this script, ensure you have the following dependencies installed in your Python environment:
8 |
9 | - Python 3.x
10 | - requests library
11 | - lxml library
12 | - pymongo library
--------------------------------------------------------------------------------
/MyAnimeList/README.md:
--------------------------------------------------------------------------------
1 | # MyAnimeList Scraper
2 |
3 | ## Overview
4 |
5 | This Python script scrapes events information from a MyAnimeList , stores it in a SQL database . It provides the TOP 50 Anime or TOP 50 Mangas as well as information about a specific anime . This README provides instructions for setting up and using the script.
6 |
7 | ## Prerequisites
8 |
9 | Before using this script, ensure that you have the following installed:
10 |
11 | - Python 3.x
12 | - `pip` package manager
13 | - MySQL
14 | - Required Python packages (install using `pip install -r requirements.txt`)
--------------------------------------------------------------------------------
/.github/workflows/label.yml:
--------------------------------------------------------------------------------
1 | # This workflow will triage pull requests and apply a label based on the
2 | # paths that are modified in the pull request.
3 | #
4 | # To use this workflow, you will need to set up a .github/labeler.yml
5 | # file with configuration. For more information, see:
6 | # https://github.com/actions/labeler
7 |
8 | name: Labeler
9 | on: [pull_request_target]
10 |
11 | jobs:
12 | label:
13 |
14 | runs-on: ubuntu-latest
15 | permissions:
16 | contents: read
17 | pull-requests: write
18 |
19 | steps:
20 | - uses: actions/labeler@v4
21 | with:
22 | repo-token: "${{ secrets.GITHUB_TOKEN }}"
23 |
--------------------------------------------------------------------------------
/Github Education/README.md:
--------------------------------------------------------------------------------
1 | # Github Education Event Scraper and Notifier
2 |
3 | ## Overview
4 |
5 | This Python script scrapes events information from a github education, stores it in a MongoDB database, and periodically checks for new events. When new events are found, it sends notifications to a specified endpoint. This README provides instructions for setting up and using the script.
6 |
7 | ## Prerequisites
8 |
9 | Before using this script, ensure that you have the following installed:
10 |
11 | - Python 3.x
12 | - `pip` package manager
13 | - MongoDB (running locally or on a remote server)
14 | - Required Python packages (install using `pip install -r requirements.txt`)
15 |
--------------------------------------------------------------------------------
/scrape_countries_population/script.py:
--------------------------------------------------------------------------------
1 | import pandas as pd
2 | import requests
3 | from bs4 import BeautifulSoup
4 |
5 | url = "https://www.worldometers.info/world-population/population-by-country"
6 | response = requests.get(url)
7 | soup = BeautifulSoup(response.text, 'html.parser')
8 | rows = soup.find("table", {'id': 'example2'}).find('tbody').find_all('tr')
9 | countries_list = []
10 |
11 | for row in rows:
12 | dic = {}
13 | dic['country'] = row.find_all('td')[1].text
14 | dic["population"] = row.find_all('td')[2].text.replace(',', '')
15 |
16 | countries_list.append(dic)
17 |
18 | df = pd.DataFrame(countries_list)
19 | df.to_excel("countries_data.xlsx", index=False)
20 | df.to_csv("countries_data.csv", index=False)
--------------------------------------------------------------------------------
/MLH/README.md:
--------------------------------------------------------------------------------
1 | # MLH Data Scraper
2 |
3 | This Python script allows you to scrape hackathon data from the MLH website and extract relevant information such as the "title," "link," "mode of participation," and "Date." It uses the `requests` library to make HTTP requests and `Selenium` for HTML parsing.
4 |
5 | ## Prerequisites
6 |
7 | Before using this script, ensure you have the following dependencies installed in your Python environment:
8 |
9 | - Python 3.x
10 | - requests library
11 | - selenium library
12 | - pymongo library
13 |
14 | ## Installation of Chrome driver for selenium on MacOS
15 | This is by far the easiest option:
16 | `brew install chromedriver --cask`
17 |
18 | To upgrade an existing installation do this:
19 | `brew upgrade chromedriver --cask`
--------------------------------------------------------------------------------
/News Laundry/README.md:
--------------------------------------------------------------------------------
1 | # News Laundry Data Scraper
2 |
3 | This Python script allows you to scrape news data from the News Laundry website and extract relevant information such as the "headline", "link", "image" and "Date". It uses the `requests` library to make HTTP requests and `Selenium` for HTML parsing.
4 |
5 | ## Prerequisites
6 |
7 | Before using this script, ensure you have the following dependencies installed in your Python environment:
8 |
9 | - Python 3.x
10 | - requests library
11 | - selenium library
12 | - pymongo library
13 |
14 | ## Installation of Chrome driver for selenium on MacOS
15 | This is by far the easiest option:
16 | `brew install chromedriver --cask`
17 |
18 | To upgrade an existing installation do this:
19 | `brew upgrade chromedriver --cask`
20 |
--------------------------------------------------------------------------------
/unstop/README.md:
--------------------------------------------------------------------------------
1 | # UNSTOP Data Scraper
2 |
3 | This Python script allows you to scrape hackathon data from the UNSTOP website and extract relevant information such as the "title," "link," "mode of participation," and "Date." It uses the `requests` library to make HTTP requests and `Selenium` for HTML parsing.
4 |
5 | ## Prerequisites
6 |
7 | Before using this script, ensure you have the following dependencies installed in your Python environment:
8 |
9 | - Python 3.x
10 | - requests library
11 | - selenium library
12 | - pymongo library
13 |
14 | ## Installation of Chrome driver for selenium on MacOS
15 | This is by far the easiest option:
16 | `brew install chromedriver --cask`
17 |
18 | To upgrade an existing installation do this:
19 | `brew upgrade chromedriver --cask`
20 |
--------------------------------------------------------------------------------
/Devpost/README.md:
--------------------------------------------------------------------------------
1 | # DEVPOST Data Scraper
2 |
3 | This Python script allows you to scrape hackathon data from the DEVPOST website and extract relevant information such as the "title," "link," "mode of participation," and "Date." It uses the `requests` library to make HTTP requests and `Selenium` for HTML parsing.
4 |
5 | ## Prerequisites
6 |
7 | Before using this script, ensure you have the following dependencies installed in your Python environment:
8 |
9 | - Python 3.x
10 | - requests library
11 | - selenium library
12 | - pymongo library
13 |
14 | ## Installation of Chrome driver for selenium on MacOS
15 | This is by far the easiest option:
16 | `brew install chromedriver --cask`
17 |
18 | To upgrade an existing installation do this:
19 | `brew upgrade chromedriver --cask`
20 |
--------------------------------------------------------------------------------
/Wynk Music Scraper/README.md:
--------------------------------------------------------------------------------
1 | # MLH Data Scraper
2 |
3 | This Python script allows you to scrape hackathon data from the MLH website and extract relevant information such as the "title," "link," "mode of participation," and "Date." It uses the `requests` library to make HTTP requests and `Selenium` for HTML parsing.
4 |
5 | ## Prerequisites
6 |
7 | Before using this script, ensure you have the following dependencies installed in your Python environment:
8 |
9 | - Python 3.x
10 | - requests library
11 | - selenium library
12 | - pymongo library
13 |
14 | ## Installation of Chrome driver for selenium on MacOS
15 | This is by far the easiest option:
16 | `brew install chromedriver --cask`
17 |
18 | To upgrade an existing installation do this:
19 | `brew upgrade chromedriver --cask`
20 |
--------------------------------------------------------------------------------
/.github/workflows/stale.yml:
--------------------------------------------------------------------------------
1 | # This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
2 | #
3 | # You can adjust the behavior by modifying this file.
4 | # For more information, see:
5 | # https://github.com/actions/stale
6 | name: Mark stale issues and pull requests
7 |
8 | on:
9 | schedule:
10 | - cron: '31 21 * * *'
11 |
12 | jobs:
13 | stale:
14 |
15 | runs-on: ubuntu-latest
16 | permissions:
17 | issues: write
18 | pull-requests: write
19 |
20 | steps:
21 | - uses: actions/stale@v5
22 | with:
23 | repo-token: ${{ secrets.GITHUB_TOKEN }}
24 | stale-issue-message: 'Thank you for your contributions to our project'
25 | stale-pr-message: 'We appreciate your contributions to our project'
26 | stale-issue-label: 'no-issue-activity'
27 | stale-pr-label: 'no-pr-activity'
28 |
--------------------------------------------------------------------------------
/Medium/README.md:
--------------------------------------------------------------------------------
1 | # Medium Scrapper
2 | Running this Script would allow the user to scrape any number of articles from [medium.com](https://medium.com/) from any category as per the user's choice
3 |
4 | ## Setup instructions
5 | In order to run this script, you need to have Python and pip installed on your system. After you're done installing Python and pip, run the following command from your terminal to install the requirements from the same folder (directory) of the project.
6 | ```
7 | pip install -r requirements.txt
8 | ```
9 |
10 | After completing all the requirements for the project, Open the terminal in the project folder and run
11 | ```
12 | python medium.py
13 | ```
14 |
15 |
16 | ## Output
17 | The user needs to enter Category and Number of articles
18 |
19 | 
20 |
21 | The scraped text files get saved in the folder in which the script is run
22 |
23 | 
24 |
25 | ## Author
26 | [Shaurya Gupta](https://github.com/Shaurya10101)
--------------------------------------------------------------------------------
/Get recipe from ingredients/README.md:
--------------------------------------------------------------------------------
1 | # Recipe Website Data Scraper
2 |
3 | This Python script allows you to scrape recipe details from ingredients entered and returns a specific recipe details based on the choice made by the user.
4 | It uses the `requests` library to make HTTP requests and `Selenium` for HTML parsing.
5 |
6 | ## EXAMPLES
7 | 
8 | 
9 |
10 |
11 |
12 | ## Prerequisites
13 |
14 | Before using this script, ensure you have the following dependencies installed in your Python environment:
15 |
16 | - Python 3.x
17 | - requests library
18 | - selenium library
19 |
20 | ## Installation of Chrome driver for selenium on MacOS
21 | This is by far the easiest option:
22 | `brew install chromedriver --cask`
23 |
24 | To upgrade an existing installation do this:
25 | `brew upgrade chromedriver --cask`
26 |
--------------------------------------------------------------------------------
/scrap_flipkart/script.py:
--------------------------------------------------------------------------------
1 | import pandas as pd
2 | import requests
3 | from bs4 import BeautifulSoup
4 | Product_name=[]
5 | Prices=[]
6 | Description=[]
7 | Reviews=[]
8 | for i in range(2,12):
9 | url="https://www.flipkart.com/search?q=mobile%20under%2050%2C000&otracker=search&otracker1=search&marketplace=FLIPKART&as-show=on&as=off"+str(i)
10 | r=requests.get(url)
11 | soup=BeautifulSoup(r.text,"lxml")
12 | soup=BeautifulSoup(r.text,"lxml")
13 | box=soup.find("div",class_="_1YokD2 _3Mn1Gg")
14 | names=box.find_all("div",class_="_4rR01T")
15 | for i in names:
16 | name=i.text
17 | Product_name.append(name)
18 | prices=box.find_all("div",class_="_30jeq3 _1_WHN1")
19 | for i in prices:
20 | name=i.text
21 | Prices.append(name)
22 | desc=box.find_all("ul",class_="_1xgFaf")
23 | for i in desc:
24 | name=i.text
25 | Description.append(name)
26 | reviews=box.find_all("div",class_="_3LWZlK")
27 | for i in reviews:
28 | name=i.text
29 | Reviews.append(i)
30 | df=pd.DataFrame({"Product Name":Product_name,"Prices":Prices,"Description":Description,"Reviews":Reviews})
31 | print(df)
--------------------------------------------------------------------------------
/Youtube/main.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | from bs4 import BeautifulSoup
3 | import pandas as pd
4 |
5 | def results(channelname):
6 | Videos=[]
7 | viewsandlikes=[]
8 | totalviews=[]
9 | likes=[]
10 | driver=webdriver.Chrome()
11 | driver.get('https://www.youtube.com/@'+str(channelname)+'/videos')
12 | content=driver.page_source.encode('utf-8').strip()
13 | soup=BeautifulSoup(content,'lxml')
14 | titles=soup.findAll('a',id='video-title-link')
15 | views=soup.findAll('span',class_="inline-metadata-item style-scope ytd-video-meta-block")
16 | for title in titles:
17 | Videos.append(title.text.split("|")[0])
18 | for view in views:
19 | viewsandlikes.append(view.text)
20 | for i in range(len(viewsandlikes)):
21 | if i%2==0:
22 | totalviews.append(viewsandlikes[i])
23 | else:
24 | likes.append(viewsandlikes[i])
25 | df=pd.DataFrame({"Videos Title":Videos,"Views":totalviews,"Likes":likes})
26 | df.to_csv(str(channelname)+"_info.csv",index=False)
27 | return "CSV file created!!"
28 |
29 | print(results(input("Please enter a Youtube Channel: ")))
--------------------------------------------------------------------------------
/.github/workflows/python-publish.yml:
--------------------------------------------------------------------------------
1 | # This workflow will upload a Python Package using Twine when a release is created
2 | # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
3 |
4 | # This workflow uses actions that are not certified by GitHub.
5 | # They are provided by a third-party and are governed by
6 | # separate terms of service, privacy policy, and support
7 | # documentation.
8 |
9 | name: Upload Python Package
10 |
11 | on:
12 | release:
13 | types: [published]
14 |
15 | permissions:
16 | contents: read
17 |
18 | jobs:
19 | deploy:
20 |
21 | runs-on: ubuntu-latest
22 |
23 | steps:
24 | - uses: actions/checkout@v3
25 | - name: Set up Python
26 | uses: actions/setup-python@v3
27 | with:
28 | python-version: '3.x'
29 | - name: Install dependencies
30 | run: |
31 | python -m pip install --upgrade pip
32 | pip install build
33 | - name: Build package
34 | run: python -m build
35 | - name: Publish package
36 | uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
37 | with:
38 | user: __token__
39 | password: ${{ secrets.PYPI_API_TOKEN }}
40 |
--------------------------------------------------------------------------------
/Internshala/README.md:
--------------------------------------------------------------------------------
1 | # Internshala Web Scraper
2 |
3 | This is a JavaScript web scraping script for Internshala, a platform for finding internships, jobs, and certification courses. It allows you to retrieve data such as internship details, job listings, and certification course information based on your search criteria.
4 |
5 | ## Script Details
6 |
7 | - **Script Name**: `internshala.js`
8 |
9 | ## Prerequisites
10 |
11 | Before running the script, make sure you have the following dependencies installed:
12 |
13 | - [Node.js](https://nodejs.org/): JavaScript runtime for executing the script.
14 | - [axios](https://www.npmjs.com/package/axios): HTTP client for making requests.
15 | - [cheerio](https://www.npmjs.com/package/cheerio): HTML parsing library.
16 |
17 | You can install these dependencies using npm (Node Package Manager):
18 |
19 | ```bash
20 | npm install axios cheerio
21 | ```
22 |
23 | ## Functions
24 | - internships()
25 | -- Scrapes and returns a list of dictionaries representing internship opportunities based on your search criteria.
26 |
27 | - jobs()
28 | -- Scrapes and returns a list of dictionaries representing job listings based on your search criteria.
29 |
30 | - certification_courses()
31 | -- Scrapes and returns a list of dictionaries representing certification courses available on Internshala.
32 |
--------------------------------------------------------------------------------
/Medium/medium.py:
--------------------------------------------------------------------------------
1 | from bs4 import BeautifulSoup
2 | import sqlite3
3 | from selenium import webdriver
4 | from selenium.webdriver.chrome.service import Service
5 | from webdriver_manager.chrome import ChromeDriverManager
6 |
7 |
8 | def getLinks():
9 | topic = str(input("Enter topic:"))
10 | num = int(input("Enter number of articles:"))
11 | url = f"https://medium.com/tag/{topic}/archive"
12 | links = []
13 | service = Service(ChromeDriverManager().install())
14 | driver = webdriver.Chrome(service=service)
15 | driver.get(url)
16 | html = driver.page_source
17 | soup = BeautifulSoup(html, "html.parser")
18 | articles = soup.find_all('article')
19 | for article in articles[:num]:
20 | anchor = article.find_all('a')[2]
21 | link = anchor.get('href').split("?")[0]
22 | links.append(link)
23 |
24 | return links
25 |
26 | def scrape_article(link):
27 | text = ""
28 | url = f"https://medium.com{link}"
29 | service = Service(ChromeDriverManager().install())
30 | driver = webdriver.Chrome(service=service)
31 | driver.get(url)
32 | html = driver.page_source
33 | soup = BeautifulSoup(html, "html.parser")
34 | paras = soup.find_all("p",class_="pw-post-body-paragraph")
35 | for para in paras:
36 | text+= str(para.text)
37 | return text
38 |
39 |
40 |
41 | if __name__=="__main__":
42 | links = getLinks()
43 | for link in links:
44 | text = scrape_article(link)
45 | with open("Data.txt", "w", encoding="utf-8") as file:
46 | file.write(text)
--------------------------------------------------------------------------------
/Wynk Music Scraper/music.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | from selenium.webdriver.chrome.options import Options
3 | from selenium.webdriver.common.by import By
4 | import time
5 | from selenium.webdriver.common.keys import Keys
6 | import requests
7 |
8 |
9 | options = Options()
10 | options.add_argument("--headless=new")
11 | driver = webdriver.Chrome(options=options)
12 |
13 | def fetch_song():
14 |
15 |
16 | driver.get("https://wynk.in/music/search")
17 |
18 | try:
19 |
20 | music_input = input("Enter the song name: ")
21 | driver.implicitly_wait(10)
22 |
23 |
24 |
25 |
26 | page = driver.find_elements(By.XPATH, '//*[@id="__next"]/header/section')
27 | # print(page)
28 |
29 |
30 |
31 |
32 | except:
33 | print("Cannot load data")
34 | for item in page:
35 | search = item.find_element(By.TAG_NAME,'input')
36 | # print(search)
37 | search.send_keys(music_input, Keys.ENTER)
38 | break
39 |
40 | search_list = driver.find_elements(By.CLASS_NAME, 'zapSearch_zapSearchList__TvGT1')
41 | # print(search_list)
42 |
43 | for item in search_list:
44 | song = item.find_element(By.TAG_NAME,'a').get_attribute("href")
45 | # print(song)
46 | break
47 |
48 | # time.sleep(10)
49 | song_details = [ music_input , song]
50 |
51 | return song_details
52 | # print(song_details)
53 |
54 |
55 |
56 | def main():
57 |
58 | #EXAMPLE
59 | song_details=fetch_song()
60 | print(song_details)
61 |
62 |
63 | if __name__ == "__main__":
64 | main()
65 |
66 |
--------------------------------------------------------------------------------
/IGDTUW/main.py:
--------------------------------------------------------------------------------
1 | import requests
2 | import lxml.html
3 | import time
4 | import json
5 |
6 | # Function to extract the latest notice information
7 | def get_latest_notice(doc):
8 | title = doc.xpath('//div[@class="container"]/div[@class="row"]//div[@class="col-sm-7"]/div[@class="bigBox"]/div[@class="bigBoxDiv"]/ul[@class="ENABox Events"]/li/a/text()')[0]
9 | link = doc.xpath('//div[@class="container"]/div[@class="row"]//div[@class="col-sm-7"]/div[@class="bigBox"]/div[@class="bigBoxDiv"]/ul[@="ENABox Events"]/li/a/@href')[0]
10 | return {
11 | "title": title,
12 | "link": "https://www.igdtuw.ac.in/" + link,
13 | "tab": "Notices/Circulars"
14 | }
15 |
16 | # Your endpoint URL
17 | endpoint_url = 'http://your_endpoint'
18 |
19 | # Initialize previous notice
20 | prev_notice = get_latest_notice(lxml.html.fromstring(requests.get('https://www.igdtuw.ac.in/').content))
21 |
22 | print("Running")
23 | while True:
24 | try:
25 | new_notice = get_latest_notice(lxml.html.fromstring(requests.get('https://www.igdtuw.ac.in/').content))
26 |
27 | if new_notice != prev_notice:
28 | # Send the new notice to your endpoint
29 | response = requests.post(endpoint_url, json=new_notice)
30 | print(new_notice)
31 |
32 | if response.status_code == 200:
33 | prev_notice = new_notice
34 | else:
35 | print("Failed to send notice to the endpoint")
36 |
37 | else:
38 | print("No update")
39 |
40 | time.sleep(10) # The program will run every 10 seconds.
41 |
42 | except Exception as e:
43 | print(e)
44 | notice = {"title": "Bot Down", "link": "", "tab": ""}
45 | response = requests.post(endpoint_url, json=notice)
46 | break
47 |
--------------------------------------------------------------------------------
/Instagram/main.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "log"
5 | "github.com/sclevine/agouti"
6 | )
7 |
8 | type InstagramScraper struct {
9 | driver *agouti.WebDriver
10 | }
11 |
12 | func NewInstagramScraper() *InstagramScraper {
13 | return &InstagramScraper{}
14 | }
15 |
16 | func (s *InstagramScraper) InitializeDriver() error {
17 | driver := agouti.PhantomJS()
18 | err := driver.Start()
19 | if err != nil {
20 | return err
21 | }
22 | s.driver = driver
23 | return nil
24 | }
25 |
26 | func (s *InstagramScraper) ScrapeUserDetails(username string) (map[string]string, error) {
27 | if s.driver == nil {
28 | if err := s.InitializeDriver(); err != nil {
29 | return nil, err
30 | }
31 | }
32 |
33 | page, err := s.driver.NewPage()
34 | if err != nil {
35 | return nil, err
36 | }
37 |
38 | err = page.Navigate("https://www.instagram.com/" + username + "/")
39 | if err != nil {
40 | return nil, err
41 | }
42 |
43 | accountDetails, err := page.Find(".-nal3").Elements()
44 | if err != nil {
45 | return nil, err
46 | }
47 |
48 | userDetails := map[string]string{
49 | "Username": username,
50 | "Number of Posts": accountDetails[0].Text(),
51 | "Number of Followers": accountDetails[1].Text(),
52 | "Number of Following": accountDetails[2].Text(),
53 | }
54 |
55 | return userDetails, nil
56 | }
57 |
58 | func (s *InstagramScraper) Close() {
59 | if s.driver != nil {
60 | _ = s.driver.Stop()
61 | }
62 | }
63 |
64 | func main() {
65 | scraper := NewInstagramScraper()
66 | defer scraper.Close()
67 |
68 | userDetails, err := scraper.ScrapeUserDetails("example_user")
69 | if err != nil {
70 | log.Fatal(err)
71 | }
72 |
73 | log.Println(userDetails)
74 | }
75 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 |
2 | ## 📁 Directory Structure
3 |
4 | The repository follows a structured approach for organizing scraping scripts:
5 |
6 | 📦 web-scrapper-repo
7 | ┣ 📂 site1
8 | ┃ ┣ 📜 script.py
9 | ┃ ┗ 📜 README.md
10 | ┃ ┗ 📜 requirements.txt
11 | ┣ 📂 site2
12 | ┃ ┣ 📜 script.py
13 | ┃ ┗ 📜 README.md
14 | ┃ ┗ 📜 requirements.txt
15 | ┗ ...
16 |
17 |
18 | Each folder (`site1`, `site2`, etc.) corresponds to a different website that we have scraped. Inside each folder, you'll find a scraping script (`script.py`) and a README.md file providing information about the scraped data.
19 |
20 | ## 🚀 How to Contribute
21 |
22 | We appreciate your contributions to make this repository better! Here's how you can contribute:
23 |
24 | ### 1. Create an Issue
25 |
26 | If you encounter issues with the existing code, or if you have suggestions for improvements, please create an issue. Be sure to provide details and context about the problem or enhancement you're proposing.
27 |
28 | ### 2. Fork and Clone
29 |
30 | To start contributing, fork this repository to your GitHub account, and then clone it to your local machine.
31 |
32 | ```bash
33 | git clone https://github.com/anupammaurya6767/web_scrapper.git
34 | ```
35 |
36 | ### 3. Create a New Feature Branch
37 | Before making changes, create a new branch for your feature or bug fix.
38 |
39 | ```bash
40 | git checkout -b feature-name
41 | ```
42 |
43 | ### 4. Make Changes and Commit
44 | Make your changes in the appropriate folder (e.g., site1). Update the scraping script and the README.md file to include information about the data you've scraped.
45 |
46 | # Data Scraped from Site1
47 |
48 | - Data 1
49 | - Data 2
50 | - ...
51 |
52 | Last Updated: [Date]
53 |
54 | #### Commit your changes and push them to your forked repository.
55 | ```bash
56 | git add .
57 | git commit -m "Added data from Site1"
58 | git push origin feature-name
59 | ```
60 | ### 5. Create a Pull Request
61 | Once you've made your changes and pushed them to your forked repository, create a pull request to merge your changes into the main repository. Provide a clear description of your changes.
62 |
63 | We'll review your contribution and merge it if it aligns with the repository's goals.
64 |
65 | Thank you for contributing to our Web Scrapper Repository! 🙌
66 |
--------------------------------------------------------------------------------
/Get recipe from ingredients/main.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | from selenium.webdriver.chrome.options import Options
3 | from selenium.webdriver.common.by import By
4 | from selenium.webdriver.support import expected_conditions as EC
5 | from selenium.webdriver.support.wait import WebDriverWait
6 | from selenium.webdriver.common.keys import Keys
7 | import time
8 |
9 |
10 | options = Options()
11 | options.add_argument("--headless=new")
12 | driver = webdriver.Chrome(options=options)
13 |
14 |
15 |
16 |
17 |
18 | # Get a comma-separated list of ingredients from the user
19 | ingredient_input = input("Enter a comma-separated list of ingredients: ")
20 |
21 | # Split the input string into a list of ingredients
22 | ingredients = ingredient_input.split(',')
23 |
24 | # Remove leading and trailing whitespaces from each ingredient
25 | ingredients = [ingredient.strip() for ingredient in ingredients]
26 | # print(ingredients)
27 |
28 |
29 | recipe_details=[]
30 |
31 | def recipe():
32 |
33 | global search_box
34 |
35 | driver.get("https://realfood.tesco.com/what-can-i-make-with.html")
36 |
37 | try:
38 |
39 | # print("in try block")
40 |
41 | elements = WebDriverWait(driver, 100).until(EC.presence_of_element_located((By.CLASS_NAME, 'autocomplete-B ')))
42 |
43 |
44 | search_box = driver.find_elements(By.XPATH, '//*[@id="ddl-recipe-finder"]/main/div[1]/div[1]/form')
45 | # print(search_box)
46 |
47 |
48 |
49 |
50 |
51 | except:
52 | print("Cannot load data")
53 |
54 |
55 |
56 | # print("above for")
57 |
58 | for i in range(0,len(ingredients)):
59 | for item in search_box:
60 | search = item.find_element(By.TAG_NAME,'input')
61 | # print(search)
62 | search.click()
63 | search.send_keys(ingredients[i])
64 | search.send_keys(Keys.RETURN)
65 | time.sleep(1)
66 |
67 |
68 | dishes = driver.find_elements(By.CLASS_NAME,'ddl-recipe-finder__list-item')
69 | # print(dishes)
70 |
71 | for dish in dishes:
72 | title = dish.find_element(By.CLASS_NAME,'ddl-recipe-card__title-text').text
73 | # print(title)
74 | link = dish.find_element(By.CLASS_NAME,'ddl-recipe-card').get_attribute("href")
75 | # print(link)
76 | img = dish.find_element(By.TAG_NAME,'img').get_attribute("src")
77 | # print(img)
78 | recipee = [title,link,img]
79 | recipe_details.append(recipee)
80 |
81 | driver.close()
82 |
83 | return recipe_details
84 |
85 |
86 |
87 |
88 |
89 | def main():
90 |
91 | recipe_list = recipe()
92 |
93 |
94 | for i in range(0,10):
95 | print(i+1,end=" ")
96 | print(recipe_list[i][0])
97 |
98 | ch= int(input("Enter your Choice: "))
99 |
100 | for i in range(0,11):
101 | if i == ch:
102 | print(recipe_details[i-1])
103 |
104 |
105 | if __name__ == "__main__":
106 | main()
107 |
--------------------------------------------------------------------------------
/Libgen/libgen.py:
--------------------------------------------------------------------------------
1 | import requests
2 | from bs4 import BeautifulSoup
3 | import json
4 | import logging
5 |
6 | class Book:
7 | def __init__(self, name, author,format, link):
8 | self.name = name
9 | self.author = author
10 | self.format = format
11 | self.link = link
12 |
13 | class LibGen:
14 | def get_books(self, book_name):
15 | results = 10
16 | mainres = 25
17 |
18 | if not book_name or len(book_name) < 3:
19 | raise ValueError("Title Too Short")
20 |
21 | book_name = book_name.replace(" ", "+")
22 | url = f"http://libgen.is/search.php?req={book_name}&lg_topic=libgen&open=0&view=simple&res={25}&phrase=1&column=def"
23 |
24 | try:
25 | res = requests.get(url)
26 | res.raise_for_status()
27 | soup = BeautifulSoup(res.text, 'html.parser')
28 |
29 | if "Search string must contain minimum 3 characters.." in soup.get_text():
30 | raise ValueError("Title Too Short")
31 |
32 | Books = []
33 | books_name = []
34 | table = soup.find_all("table")[2]
35 | table_rows = table.find_all("tr")[1:]
36 |
37 | for i, row in enumerate(table_rows):
38 | if len(Books) >= results:
39 | break
40 |
41 | table_datas = row.find_all("td")
42 | book_name = table_datas[2].get_text()
43 |
44 | author = table_datas[1].get_text()
45 | link1 = table_datas[9].find("a",href = True)
46 | language = table_datas[6].get_text()
47 | type_of_it = table_datas[8].get_text()
48 |
49 | if (type_of_it != "pdf" and type_of_it != "epub") or language != "English":
50 | continue
51 |
52 | book = Book(
53 | name=book_name,
54 | author=author,
55 | format=type_of_it,
56 | # link=link_info[0]
57 | link = link1.get("href")
58 | )
59 |
60 | Books.append(book)
61 |
62 | if len(Books) >= 1:
63 | return Books
64 | else:
65 | raise ValueError("No results found")
66 |
67 | except Exception as e:
68 | raise ValueError(f"Error: {e}")
69 |
70 | if __name__ == "__main__":
71 | logging.basicConfig(level=logging.ERROR)
72 | libgen_scraper = LibGen()
73 | book_name = input("enter book name: ")
74 | BOOKS_DETAILS = []
75 |
76 |
77 |
78 | book_data = libgen_scraper.get_books(book_name)
79 | for book in book_data:
80 | BOOKS_DETAILS.append([book.name,book.author,book.format,book.link])
81 |
82 | for num in range(len(BOOKS_DETAILS)):
83 | print(num,BOOKS_DETAILS[num][0])
84 |
85 | which_book = int(input("which book do you want(enter the number): "))
86 |
87 |
88 | print("Name:", BOOKS_DETAILS[which_book][0])
89 | print("Author:", BOOKS_DETAILS[which_book][1])
90 | print("Format:", BOOKS_DETAILS[which_book][2])
91 | print("Link:", BOOKS_DETAILS[which_book][3])
92 | print()
93 |
94 |
95 |
96 |
--------------------------------------------------------------------------------
/Libgen/libgen.js:
--------------------------------------------------------------------------------
1 | const axios = require('axios');
2 | const cheerio = require('cheerio');
3 |
4 | async function linkToGet(link) {
5 | try {
6 | const response = await axios.get(link);
7 | const thHtml = cheerio.load(response.data);
8 | const tdAll = thHtml('td#info');
9 | const tdA = tdAll.find('a');
10 | const linkHref = tdA.eq(1).attr('href');
11 | const imgLinkTd = tdAll.find('img[alt="cover"]');
12 | const imgLinkSrc = imgLinkTd.attr('src');
13 | const imgLink = `http://library.lol${imgLinkSrc}`;
14 | return [linkHref, imgLink];
15 | } catch (error) {
16 | console.error('Error in linkToGet:', error);
17 | throw error;
18 | }
19 | }
20 |
21 | class LibGenScraper {
22 | async getBooks(bookName) {
23 | try {
24 | const Books = [];
25 | const results = 10;
26 | const mainres = 25;
27 |
28 | if (!bookName || bookName.length < 3) {
29 | throw new Error('Title Too Short');
30 | }
31 |
32 | bookName = bookName.replace(/ /g, '+');
33 | const url = `http://libgen.is/search.php?req=${bookName}&lg_topic=libgen&open=0&view=simple&res=${mainres}&phrase=1&column=def`;
34 |
35 | const response = await axios.get(url);
36 | const $ = cheerio.load(response.data);
37 |
38 | if ($('body').text().includes('Search string must contain minimum 3 characters..')) {
39 | throw new Error('Title Too Short');
40 | }
41 |
42 | const table = $('table').eq(2);
43 | const tableRows = table.find('tr');
44 | const objKeys = ["name", "author", "size", "format", "link", "language"];
45 |
46 | for (let i = 1, counter = 1; i < tableRows.length && counter <= results; i++) {
47 | const row = tableRows.eq(i);
48 | const tableDatas = row.find('td');
49 | const bookName = tableDatas.eq(2).text();
50 | const author = tableDatas.eq(1).text();
51 | const link = tableDatas.eq(9).find('a').attr('href');
52 | const [linkHref, imgLink] = await linkToGet(link);
53 | const language = tableDatas.eq(6).text();
54 | const size = tableDatas.eq(7).text();
55 | const typeOfIt = tableDatas.eq(8).text();
56 |
57 | if ((typeOfIt !== 'pdf' && typeOfIt !== 'epub') || language !== 'English') {
58 | continue;
59 | }
60 |
61 | const book = {
62 | name: bookName,
63 | author: author,
64 | size: size,
65 | format: typeOfIt,
66 | link: linkHref,
67 | language: imgLink
68 | };
69 |
70 | Books.push(book);
71 | counter++;
72 | }
73 |
74 | if (Books.length >= 1) {
75 | return Books;
76 | } else {
77 | throw new Error('No results found');
78 | }
79 | } catch (error) {
80 | console.error('Error in getBooks:', error.message);
81 | throw error.message;
82 | }
83 | }
84 | }
85 |
86 | module.exports = LibGenScraper;
87 |
--------------------------------------------------------------------------------
/MyAnimeList/database.py:
--------------------------------------------------------------------------------
1 | import sqlite3
2 | from scraper import MALScraper
3 |
4 | # Connect to the SQLite database
5 | conn = sqlite3.connect('anime_database.db')#Add your own database name
6 | cursor = conn.cursor()
7 |
8 | cursor = conn.cursor()
9 |
10 | cursor.execute('''
11 | CREATE TABLE IF NOT EXISTS TopAnime (
12 | Rank INTEGER PRIMARY KEY,
13 | AnimeName TEXT,
14 | Score TEXT,
15 | Episodes TEXT,
16 | Duration TEXT,
17 | Members TEXT
18 | )
19 | ''')
20 |
21 | cursor.execute('''
22 | CREATE TABLE IF NOT EXISTS TopManga (
23 | Rank INTEGER PRIMARY KEY,
24 | MangaName TEXT,
25 | Score TEXT,
26 | Episodes TEXT,
27 | Duration TEXT,
28 | Members TEXT
29 | )
30 | ''')
31 |
32 | cursor.execute('''
33 | CREATE TABLE IF NOT EXISTS SeasonalAnime (
34 | Title TEXT PRIMARY KEY,
35 | Episodes TEXT,
36 | AiringDate TEXT,
37 | Genres TEXT
38 | )
39 | ''')
40 |
41 | cursor.execute('''
42 | CREATE TABLE IF NOT EXISTS SpecificAnime (
43 | Title TEXT PRIMARY KEY,
44 | Episodes TEXT,
45 | Score TEXT,
46 | Synopsis TEXT
47 | )
48 | ''')
49 |
50 | conn.commit()
51 |
52 |
53 |
54 | # Create an instance of the MALScraper class
55 | base_url = "https://myanimelist.net"
56 | scraper = MALScraper(base_url)
57 |
58 | # Function to insert data into respective tables based on user choice
59 | def insert_data(choice):
60 | if choice == "seasonal":
61 | year = int(input("Enter year:"))
62 | season = str(input("Enter season:"))
63 | seasonal_anime_data = scraper.scrape_seasonal_anime(year, season)
64 | cursor.executemany("INSERT INTO SeasonalAnime VALUES (?, ?, ?, ?)", seasonal_anime_data)
65 | elif choice == "top anime":
66 | top_anime_data = scraper.scrape_top_anime()
67 | cursor.executemany("INSERT INTO TopAnime VALUES (?, ?, ?, ?, ?, ?)", top_anime_data)
68 | print(top_anime_data)
69 | elif choice == "top manga":
70 | top_manga_data = scraper.scrape_top_manga()
71 | cursor.executemany("INSERT INTO TopManga VALUES (?, ?, ?, ?, ?, ?)", top_manga_data)
72 | elif choice == "specific":
73 | name = str(input("Enter anime name:"))
74 | specific_anime_data = scraper.scrape_specific_anime(name)
75 | cursor.executemany("INSERT INTO SpecificAnime VALUES (?, ?, ?, ?)", specific_anime_data)
76 | else:
77 | print("Invalid choice.")
78 |
79 | conn.commit()
80 |
81 | # Function to display the tables
82 |
83 | def display_tables():
84 | for table in ['TopAnime', 'TopManga', 'SeasonalAnime', 'SpecificAnime']:
85 | print(f"\nDisplaying {table}:\n")
86 | cursor.execute(f"SELECT * FROM {table}")
87 | rows = cursor.fetchall()
88 | for row in rows:
89 | print(row)
90 |
91 |
92 | if __name__ == "__main__":
93 | print("Available choices: 'seasonal', 'top anime', 'top manga', 'specific'")
94 | choice = input("Enter your choice: ").lower()
95 |
96 | # Call the function to insert data into tables based on user choice
97 | insert_data(choice)
98 |
99 | # Call the function to display the tables
100 | #display_tables()
101 |
102 | # Close the database connection
103 | conn.close()
104 |
--------------------------------------------------------------------------------
/GFG/scraper.py:
--------------------------------------------------------------------------------
1 | import sqlite3
2 | from bs4 import BeautifulSoup
3 | from selenium import webdriver
4 | from webdriver_manager.chrome import ChromeDriverManager
5 |
6 | class CourseScraper:
7 | def __init__(self, db_name):
8 | # Initialize SQLite database connection
9 | self.conn = sqlite3.connect(db_name)
10 | self.cur = self.conn.cursor()
11 | self.create_courses_table()
12 |
13 | def create_courses_table(self):
14 | # Create the 'COURSES' table if it doesn't exist
15 | self.cur.execute('''
16 | CREATE TABLE IF NOT EXISTS COURSES (
17 | NAME text,
18 | RATING text,
19 | INTERESTED text,
20 | PRICE text
21 | )
22 | ''')
23 | self.conn.commit()
24 |
25 | def insert_data(self, data):
26 | try:
27 | self.cur.executemany("INSERT INTO COURSES VALUES (?, ?, ?, ?)", data)
28 | self.conn.commit()
29 | print("Data successfully inserted.")
30 | except sqlite3.Error as e:
31 | print(f"An error occurred: {e}")
32 |
33 | def get_course_data(self, course_section):
34 | courses = []
35 | for item in course_section.find_all("a", class_="ui card courseListingPage_courseCardContainer__lLZiS"):
36 | course_name = item.find("h4", class_="ui left aligned header courseListingPage_myAuto__i6GdI sofia-pro course_heading").text
37 | course_rating = item.find("span", class_="urw-din")
38 | course_rating = "Information not available" if course_rating is None else course_rating.text
39 | course_interested = item.find("div", class_="courseListingPage_descriptionText__zN_K1 sofia-pro g-opacity-50 g-mb-0 grid_with__meta").text.split(" ")[0]
40 | course_price = item.find("p", class_="sofia-pro g-mb-0 courseListingPage_batchFee__0NlbJ")
41 | course_price = "0" if course_price is None else course_price.text
42 |
43 | courses.append((
44 | course_name,
45 | course_rating,
46 | course_interested,
47 | course_price
48 | ))
49 |
50 | return courses
51 |
52 | def scrape_geeksforgeeks(self, url):
53 | # Initialize ChromeDriver and scrape the course data
54 | service = webdriver.chrome.service.Service(ChromeDriverManager().install())
55 | driver = webdriver.Chrome(service=service)
56 | driver.get(url)
57 | html = driver.page_source
58 | soup = BeautifulSoup(html, "html.parser")
59 |
60 | popular_courses = soup.find("div", class_="ui cards courseListingPage_cardLayout__multW courseListingPage_toggleCourseCards__pWBVA")
61 | other_courses = soup.find_all("div", class_="ui cards courseListingPage_cardLayout__multW courseListingPage_courseCardsGrid__VYBzZ")
62 | all_courses_data = self.get_course_data(popular_courses)
63 | for course in other_courses:
64 | course_data = self.get_course_data(course)
65 | all_courses_data.extend(course_data)
66 | driver.quit()
67 | return all_courses_data
68 |
69 | if __name__ == '__main__':
70 | db_name = "Courses.db"
71 | url = "https://practice.geeksforgeeks.org/courses?utm_source=geeksforgeeks&utm_medium=main_header&utm_campaign=courses"
72 |
73 | scraper = CourseScraper(db_name)
74 | data = scraper.scrape_geeksforgeeks(url)
75 | print("Data to be inserted:", data)
76 | scraper.insert_data(data)
77 |
--------------------------------------------------------------------------------
/News Laundry/main.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | from selenium.webdriver.chrome.options import Options
3 | from selenium.webdriver.common.by import By
4 | from selenium.webdriver.support import expected_conditions as EC
5 | from selenium.webdriver.support.wait import WebDriverWait
6 | from pymongo import MongoClient
7 | from datetime import date, timedelta
8 | from time import sleep
9 | import requests
10 |
11 | # Replace these placeholders with your actual MongoDB URL and database name
12 | # MONGODB_URL = 'YOUR MONGODB URL'
13 | # DATABASE_NAME = 'YOUR DATABASE NAME'
14 |
15 | # Initialize MongoDB client and database
16 | # client = MongoClient(MONGODB_URL)
17 | # db = client[DATABASE_NAME]
18 | # news_collection = db['prev_hackathons']
19 |
20 |
21 | options = Options()
22 | options.add_argument("--headless=new")
23 | driver = webdriver.Chrome(options=options)
24 |
25 |
26 |
27 |
28 | NEWS=[]
29 | news_collection=[]
30 | def fetch_news():
31 |
32 | print("Fetching news...")
33 | driver.get("https://www.newslaundry.com/")
34 |
35 | try:
36 |
37 | elements = WebDriverWait(driver, 100).until(EC.presence_of_element_located((By.CLASS_NAME, 'container')))
38 |
39 |
40 | boxes = driver.find_elements(By.CLASS_NAME, '_31QO6')
41 |
42 | # side_content = driver.find_elements(By.CLASS_NAME, 'info')
43 | # hackathons_container = driver.find_elements(By.CLASS_NAME,'hackathons-container')
44 |
45 |
46 | except:
47 | print("Cannot load data")
48 |
49 | for box in boxes:
50 | head_line = box.find_element(By.TAG_NAME,'h2').text
51 | # print(head_line)
52 |
53 | link = box.find_element(By.TAG_NAME,'a').get_attribute("href")
54 | # print(link)
55 |
56 | img = box.find_element(By.TAG_NAME,'img').get_attribute("src")
57 | # print(img)
58 |
59 | date = box.find_element(By.TAG_NAME,'time').text
60 | # print(date)
61 |
62 |
63 | news_details = [img, head_line, link, date]
64 | NEWS.append(news_details)
65 |
66 | # print(NEWS)
67 | return NEWS
68 |
69 |
70 |
71 |
72 |
73 |
74 | def validate_hacks():
75 | all_news = fetch_news()
76 | new_news = []
77 |
78 | print("Validating news...")
79 | for news in all_news:
80 | if news not in news_collection:
81 | new_news.append(news)
82 |
83 | # print(new_news)
84 | return new_news
85 |
86 |
87 | def main():
88 |
89 |
90 |
91 | print("Running...")
92 |
93 | while True:
94 |
95 | try:
96 | new_news = validate_hacks()
97 | #
98 | if new_news:
99 | print("Latest news found on News Laundry: ")
100 | #
101 | for news in new_news:
102 | print(news)
103 |
104 | else:
105 | print("No new news")
106 | break
107 |
108 |
109 |
110 |
111 | # sending new hackathons to endpoint
112 | ENDPOINT_URL = 'YOUR_ENDPOINT_URL_HERE'
113 | try:
114 | response = requests.post(ENDPOINT_URL, json=new_news)
115 | response.raise_for_status() # Raise an exception if the request fails (e.g., 4xx or 5xx status codes)
116 | print("Successfully sent latest news to the endpoint.")
117 | except requests.exceptions.RequestException as request_error:
118 | print("Error sending news to the endpoint:", request_error)
119 |
120 | # Insert new hackathons into MongoDB
121 | # news_collection.insert_many(new_news)
122 | break
123 |
124 | except Exception as E:
125 | print("Error:", E)
126 | driver.quit()
127 | break
128 |
129 |
130 | if __name__ == "__main__":
131 | main()
132 |
--------------------------------------------------------------------------------
/Libgen/libgen.ts:
--------------------------------------------------------------------------------
1 | import axios from 'axios';
2 | import cheerio from 'cheerio';
3 |
4 | async function linkToGet(link: string): Promise<[string, string]> {
5 | try {
6 | const response = await axios.get(link);
7 | const thHtml = cheerio.load(response.data);
8 | const tdAll = thHtml('td#info');
9 | const tdA = tdAll.find('a');
10 | const linkHref = tdA.eq(1).attr('href');
11 | const imgLinkTd = tdAll.find('img[alt="cover"]');
12 | const imgLinkSrc = imgLinkTd.attr('src');
13 | const imgLink = `http://library.lol${imgLinkSrc}`;
14 | return [linkHref, imgLink];
15 | } catch (error) {
16 | console.error('Error in linkToGet:', error);
17 | throw error;
18 | }
19 | }
20 |
21 | class LibGen {
22 | constructor() {
23 | // Constructor for LibGen class (if needed)
24 | }
25 |
26 | async getBooks(bookName: string): Promise {
27 | try {
28 | const Books: any[] = [];
29 | const results = 10;
30 | const mainres = 25;
31 |
32 | if (!bookName || bookName.length < 3) {
33 | throw new Error('Title Too Short');
34 | }
35 |
36 | bookName = bookName.replace(/ /g, '+');
37 | const url = `http://libgen.is/search.php?req=${bookName}&lg_topic=libgen&open=0&view=simple&res=${mainres}&phrase=1&column=def`;
38 |
39 | const response = await axios.get(url);
40 | const $ = cheerio.load(response.data);
41 |
42 | if ($('body').text().includes('Search string must contain minimum 3 characters..')) {
43 | throw new Error('Title Too Short');
44 | }
45 |
46 | const table = $('table').eq(2);
47 | const tableRows = table.find('tr');
48 | const objKeys = ['name', 'author', 'size', 'format', 'link', 'language'];
49 |
50 | for (let i = 1, counter = 1; i < tableRows.length && counter <= results; i++) {
51 | const row = tableRows.eq(i);
52 | const tableDatas = row.find('td');
53 | const bookName = tableDatas.eq(2).text();
54 | const author = tableDatas.eq(1).text();
55 | const link = tableDatas.eq(9).find('a').attr('href');
56 | const [linkHref, imgLink] = await linkToGet(link);
57 | const language = tableDatas.eq(6).text();
58 | const size = tableDatas.eq(7).text();
59 | const typeOfIt = tableDatas.eq(8).text();
60 |
61 | if ((typeOfIt !== 'pdf' && typeOfIt !== 'epub') || language !== 'English') {
62 | continue;
63 | }
64 |
65 | const book = {
66 | name: bookName,
67 | author: author,
68 | size: size,
69 | format: typeOfIt,
70 | link: linkHref,
71 | language: imgLink,
72 | };
73 |
74 | Books.push(book);
75 | counter++;
76 | }
77 |
78 | if (Books.length >= 1) {
79 | return Books;
80 | } else {
81 | throw new Error('No results found');
82 | }
83 | } catch (error) {
84 | console.error('Error in getBooks:', error.message);
85 | throw error.message;
86 | }
87 | }
88 | }
89 |
90 | // Usage
91 | const libGenScraper = new LibGen();
92 | const bookName = 'Python'; // Replace with the desired book name
93 | libGenScraper
94 | .getBooks(bookName)
95 | .then((bookData) => {
96 | if (Array.isArray(bookData)) {
97 | bookData.forEach((book) => {
98 | console.log('Name:', book.name);
99 | console.log('Author:', book.author);
100 | console.log('Size:', book.size);
101 | console.log('Format:', book.format);
102 | console.log('Link:', book.link);
103 | console.log('Language:', book.language);
104 | console.log();
105 | });
106 | } else {
107 | console.error('Error:', bookData);
108 | }
109 | })
110 | .catch((error) => {
111 | console.error('Unknown error occurred:', error);
112 | });
113 |
--------------------------------------------------------------------------------
/Github Education/main.py:
--------------------------------------------------------------------------------
1 | import requests
2 | from bs4 import BeautifulSoup
3 | import time
4 | from pymongo import MongoClient
5 |
6 | class EventScraper:
7 | def __init__(self, db_uri, db_name, endpoint_url):
8 | # Initialize MongoDB connection
9 | self.client = MongoClient(db_uri)
10 | self.db = self.client[db_name]
11 | self.events_collection = self.db['events']
12 | self.endpoint_url = endpoint_url
13 |
14 | def get_events(self):
15 | try:
16 | url = "https://education.github.com/events"
17 | res = requests.get(url)
18 | soup = BeautifulSoup(res.text, "html.parser")
19 |
20 | events_data = []
21 |
22 | for e in soup.find_all("a", class_="d-flex js-landing-page-link event-card"):
23 | title = e.find("h3", class_="h5").get_text(strip=True)
24 | img = e.find("img")["src"]
25 | desc = e.find("p", class_="my-3 short-event color-fg-muted").get_text(strip=True, default="")
26 | base = e.find_all("p", class_="color-fg-muted text-small")
27 | date, loc = [item.get_text(strip=True) for item in base[:2]]
28 | lang = e.find("p", class_="color-fg-muted text-small mb-3").get_text(strip=True)
29 | tags_list = [l.get_text(strip=True) for l in e.find_all("span", class_="Label--small Label--blue-standard mr-2")]
30 | link = e["href"]
31 |
32 | events_data.append({
33 | "title": title,
34 | "image_url": img,
35 | "description": desc,
36 | "date": date,
37 | "location": loc,
38 | "language": lang,
39 | "tags": tags_list,
40 | "link": link,
41 | })
42 |
43 | return events_data
44 |
45 | except requests.exceptions.RequestException as request_error:
46 | print("Error fetching events:", request_error)
47 | return []
48 |
49 | def check_and_send_events(self):
50 | while True:
51 | try:
52 | current_events = self.get_events()
53 | new_events = [event for event in current_events if not self.events_collection.find_one(event)]
54 |
55 | if new_events:
56 | print("New events found:")
57 | for event in new_events:
58 | pass # Specific actions for new events can be added here
59 | print(new_events)
60 |
61 | try:
62 | response = requests.post(self.endpoint_url, json=new_events)
63 | response.raise_for_status()
64 | print("Successfully sent new events to the endpoint.")
65 | except requests.exceptions.RequestException as request_error:
66 | print("Error sending events to the endpoint:", request_error)
67 |
68 | self.events_collection.insert_many(new_events)
69 |
70 | else:
71 | print("No new events")
72 |
73 | except Exception as e:
74 | print("Error:", e)
75 | notice = {"title": "Bot Down", "link": "", "mode": "", "Date": ""}
76 | response = requests.post(self.endpoint_url, json=notice)
77 | print(response.text)
78 | break
79 |
80 | time.sleep(600) # Sleep for 10 minutes (adjust as needed)
81 |
82 | if __name__ == "__main__":
83 | # Replace with your MongoDB URI, database name, and endpoint URL
84 | db_uri = 'mongodb://your_username:your_password@localhost:27017'
85 | db_name = 'your_database_name'
86 | endpoint_url = 'YOUR_ENDPOINT_URL_HERE'
87 |
88 | event_scraper = EventScraper(db_uri, db_name, endpoint_url)
89 | event_scraper.check_and_send_events()
90 |
--------------------------------------------------------------------------------
/Libgen/libgen.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "errors"
5 | "fmt"
6 | "log"
7 | "net/http"
8 | "strings"
9 |
10 | "github.com/PuerkitoBio/goquery"
11 | )
12 |
13 | func linkToGet(link string) ([2]string, error) {
14 | res, err := http.Get(link)
15 | if err != nil {
16 | return [2]string{}, err
17 | }
18 | defer res.Body.Close()
19 |
20 | if res.StatusCode != 200 {
21 | return [2]string{}, errors.New("Request failed with status: " + res.Status)
22 | }
23 |
24 | doc, err := goquery.NewDocumentFromReader(res.Body)
25 | if err != nil {
26 | return [2]string{}, err
27 | }
28 |
29 | linkHref, _ := doc.Find("td#info a:eq(1)").Attr("href")
30 | imgLinkSrc, _ := doc.Find("td#info img[alt=cover]").Attr("src")
31 | imgLink := "http://library.lol" + imgLinkSrc
32 |
33 | return [2]string{linkHref, imgLink}, nil
34 | }
35 |
36 | type Book struct {
37 | Name string `json:"name"`
38 | Author string `json:"author"`
39 | Size string `json:"size"`
40 | Format string `json:"format"`
41 | Link string `json:"link"`
42 | Language string `json:"language"`
43 | }
44 |
45 | type LibGen struct{}
46 |
47 | func (lg *LibGen) getBooks(bookName string) ([]Book, error) {
48 | const results = 10
49 | const mainres = 25
50 |
51 | if bookName == "" || len(bookName) < 3 {
52 | return nil, errors.New("Title Too Short")
53 | }
54 |
55 | bookName = strings.ReplaceAll(bookName, " ", "+")
56 | url := fmt.Sprintf("http://libgen.is/search.php?req=%s&lg_topic=libgen&open=0&view=simple&res=%d&phrase=1&column=def", bookName, mainres)
57 |
58 | res, err := http.Get(url)
59 | if err != nil {
60 | return nil, err
61 | }
62 | defer res.Body.Close()
63 |
64 | if res.StatusCode != 200 {
65 | return nil, errors.New("Request failed with status: " + res.Status)
66 | }
67 |
68 | doc, err := goquery.NewDocumentFromReader(res.Body)
69 | if err != nil {
70 | return nil, err
71 | }
72 |
73 | if strings.Contains(doc.Text(), "Search string must contain minimum 3 characters..") {
74 | return nil, errors.New("Title Too Short")
75 | }
76 |
77 | var Books []Book
78 | objKeys := []string{"name", "author", "size", "format", "link", "language"}
79 |
80 | table := doc.Find("table").Eq(2)
81 | tableRows := table.Find("tr")
82 | for i := 1; i < tableRows.Length() && len(Books) < results; i++ {
83 | row := tableRows.Eq(i)
84 | tableDatas := row.Find("td")
85 | bookName := tableDatas.Eq(2).Text()
86 | author := tableDatas.Eq(1).Text()
87 | link, _ := tableDatas.Eq(9).Find("a").Attr("href")
88 | linkInfo, err := linkToGet(link)
89 | if err != nil {
90 | log.Println("Error in linkToGet:", err)
91 | continue
92 | }
93 | language := tableDatas.Eq(6).Text()
94 | size := tableDatas.Eq(7).Text()
95 | typeOfIt := tableDatas.Eq(8).Text()
96 |
97 | if (typeOfIt != "pdf" && typeOfIt != "epub") || language != "English" {
98 | continue
99 | }
100 |
101 | book := Book{
102 | Name: bookName,
103 | Author: author,
104 | Size: size,
105 | Format: typeOfIt,
106 | Link: linkInfo[0],
107 | Language: linkInfo[1],
108 | }
109 |
110 | Books = append(Books, book)
111 | }
112 |
113 | if len(Books) >= 1 {
114 | return Books, nil
115 | } else {
116 | return nil, errors.New("No results found")
117 | }
118 | }
119 |
120 | func main() {
121 | libGenScraper := &LibGen{}
122 | bookName := "Python" // Replace with the desired book name
123 | bookData, err := libGenScraper.getBooks(bookName)
124 | if err != nil {
125 | log.Println("Error:", err)
126 | return
127 | }
128 |
129 | for _, book := range bookData {
130 | fmt.Println("Name:", book.Name)
131 | fmt.Println("Author:", book.Author)
132 | fmt.Println("Size:", book.Size)
133 | fmt.Println("Format:", book.Format)
134 | fmt.Println("Link:", book.Link)
135 | fmt.Println("Language:", book.Language)
136 | fmt.Println()
137 | }
138 | }
139 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | [![Contributors][contributors-shield]][contributors-url]
3 | [![Forks][forks-shield]][forks-url]
4 | [![Stargazers][stars-shield]][stars-url]
5 | [![Issues][issues-shield]][issues-url]
6 | [![GPL-3.0 license][license-shield]][license-url]
7 |
8 |
9 |
10 |
11 | # 🌟 Web Scrapper 🌟
12 |
13 | Welcome to our web scrapping repository! This repository contains various scraping scripts using modules like lxml, BeautifulSoup, and Selenium to gather data from different websites. 🎉
14 |
15 |
16 |
17 |
18 | ## 📁 Directory Structure
19 |
20 | The repository follows a structured approach for organizing scraping scripts:
21 |
22 | 📦 web-scrapper-repo
23 | ┣ 📂 site1
24 | ┃ ┣ 📜 script.py
25 | ┃ ┗ 📜 README.md
26 | ┃ ┗ 📜 requirements.txt
27 | ┣ 📂 site2
28 | ┃ ┣ 📜 script.py
29 | ┃ ┗ 📜 README.md
30 | ┃ ┗ 📜 requirements.txt
31 | ┗ ...
32 |
33 |
34 | Each folder (`site1`, `site2`, etc.) corresponds to a different website that we have scraped. Inside each folder, you'll find a scraping script (`script.py`) and a README.md file providing information about the scraped data.
35 |
36 | ## 🚀 How to Contribute
37 |
38 | We appreciate your contributions to make this repository better! Here's how you can contribute:
39 |
40 | ### 1. Create an Issue
41 |
42 | If you encounter issues with the existing code, or if you have suggestions for improvements, please create an issue. Be sure to provide details and context about the problem or enhancement you're proposing.
43 |
44 | ### 2. Fork and Clone
45 |
46 | To start contributing, fork this repository to your GitHub account, and then clone it to your local machine.
47 |
48 | ```bash
49 | git clone https://github.com/anupammaurya6767/web_scrapper.git
50 | ```
51 |
52 | ### 3. Create a New Feature Branch
53 | Before making changes, create a new branch for your feature or bug fix.
54 |
55 | ```bash
56 | git checkout -b feature-name
57 | ```
58 |
59 | ### 4. Make Changes and Commit
60 | Make your changes in the appropriate folder (e.g., site1). Update the scraping script and the README.md file to include information about the data you've scraped.
61 |
62 | # Data Scraped from Site1
63 |
64 | - Data 1
65 | - Data 2
66 | - ...
67 |
68 | Last Updated: [Date]
69 |
70 | #### Commit your changes and push them to your forked repository.
71 | ```bash
72 | git add .
73 | git commit -m "Added data from Site1"
74 | git push origin feature-name
75 | ```
76 | ### 5. Create a Pull Request
77 | Once you've made your changes and pushed them to your forked repository, create a pull request to merge your changes into the main repository. Provide a clear description of your changes.
78 |
79 | We'll review your contribution and merge it if it aligns with the repository's goals.
80 |
81 | Thank you for contributing to our Web Scrapper Repository! 🙌
82 |
83 |
84 |
85 |
86 | [contributors-shield]: https://img.shields.io/github/contributors/anupammaurya6767/web_scrapper.svg?style=for-the-badge
87 | [contributors-url]: https://github.com/anupammaurya6767/web_scrapper/graphs/contributors
88 | [forks-shield]: https://img.shields.io/github/forks/anupammaurya6767/web_scrapper.svg?style=for-the-badge
89 | [forks-url]: https://github.com/anupammaurya6767/web_scrapper/network/members
90 | [stars-shield]: https://img.shields.io/github/stars/anupammaurya6767/web_scrapper.svg?style=for-the-badge
91 | [stars-url]: https://github.com/anupammaurya6767/web_scrapper/stargazers
92 | [issues-shield]: https://img.shields.io/github/issues/anupammaurya6767/web_scrapper.svg?style=for-the-badge
93 | [issues-url]: https://github.com/anupammaurya6767/web_scrapper/issues
94 | [license-shield]: https://img.shields.io/github/license/anupammaurya6767/web_scrapper.svg?style=for-the-badge
95 | [license-url]: https://github.com/anupammaurya6767/web_scrapper/blob/main/LICENSE
96 |
97 |
98 |
--------------------------------------------------------------------------------
/Medium/Data.txt:
--------------------------------------------------------------------------------
1 | Faster analytics and smarter insights are the new ways to business and new way to cloud. As an example, I want to talk about just how many data points MLB captures with Google Cloud in a single game. Watch this video:Statcast is an analytics application that let’s you search MLB’s Statcast database. As you see in this video, there are so many attributes that go into analyzing a game and players. Together with MLB, Google Cloud captures and analyzes 15 million data points, in real time, every single game.The data points are used to derive insights in real time, like, catch probability, distance needed, win probability, perceived velocity, hit distance, spin rate, battled ball direction, quality of contact and so many more. Now I’m not going to discuss the analytics of the game further.I just wanted to bring to your attention just how important it is to deliver analytics and insights faster and in real time, for any business.One of the major challenges that organizations face in delivering such real time metrics is integrating services: either on the same cloud platform or products across platforms and more often than not, on-premise to cloud. Integrating analytics and other applications (for eg. a trained model endpoint) to your data, requires your endpoint to be invoked from where your data near real-time. In order to enable this integration, teams build complex solutions or end up compromising on performance.Integrating multiple services at high velocity to derive business and data insights with the help of serverless products is what we call programmable cloud.Giving you the ability to expose Cloud Functions as a remote function that can be invoked directly from BigQuery SQL, makes your application super-powerful, because you handle storage and insights in one place — exactly where your data resides!Let’s look at this with a hands-on example. In this hands-on we will create a Python Cloud Function to predict the success score of a movie based on 2 attributes: it’s GENRE and RUNTIME. This function will be invoked as a remote function in a BIGQUERY SQL to predict the success score for a movie stored in a BigQuery table.Let’s create a Python Cloud Function: Source code in repo. You can also see the main.py here for your reference, comments are pretty self-explanatory for each line of code:a. Open Cloud Shell Editorb. Create a new directory in the root, named “movie-score-remote”c. Open Cloud Shell Terminal and run below commands:c. This command should upload the all the files from the repo to your folder movie-score-remote — main.py, requirements.txt, movies_bq_src.csv and movies_bq_src_predict.csvDeploy Cloud Functiona. Open Cloud Shell Terminal and make sure you are still in the directory movie-score-remoteb. To deploy the CF, run:Create BigQuery Dataset, BigLake Connection and a Tablea. Create Dataset named “movies” in BigQuery in the region us-central1 by running the below command in Cloud Shell Terminal:b. Create an External Connection by clicking the ADD button on the top left corner of the BigQuery consolec. Click Connections to external data sources and select Connection Type as “BigLake and remote functions (cloud resource)”d. Provide the same region as the dataset (us-central1) and click CREATE DATASETe. Copy the Service Account in the Connection Configuration page and save it somewhere for later usef. Create a table and load data to be predicted: From the Cloud Shell Terminal, run below command:Create Remote Functionsa. Open Query Editor in BigQuery console and enter the following command to create the remote function:Predicta. Now that the model is created. you can use test your remote function. Run the following SQL query:b. You should see the result like this:Note:You have successfully predicted the score of a movie stored in BigQuery table using the model that you created in a Python program that is deployed as a Serverless Cloud Function!!! Read more in the documentation to implement this on a batch of records.As an exercise, try leveraging the power of BigQuery in handling unstructured data by extending this use case to include images or video snippets and unifying structured and unstructured data in a query for your insights and ML.
--------------------------------------------------------------------------------
/MLH/main.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | from selenium.webdriver.chrome.options import Options
3 | from selenium.webdriver.common.by import By
4 | from selenium.webdriver.support import expected_conditions as EC
5 | from selenium.webdriver.support.wait import WebDriverWait
6 |
7 | from datetime import date, timedelta
8 | from time import sleep
9 | from pymongo import MongoClient
10 |
11 | import requests
12 |
13 |
14 | # Replace these placeholders with your actual MongoDB URL and database name
15 | MONGODB_URL = 'YOUR_MONGODB_URL_HERE'
16 | DATABASE_NAME = 'YOUR_DATABASE_NAME_HERE'
17 |
18 | # Initialize MongoDB client and database
19 | client = MongoClient(MONGODB_URL)
20 | db = client[DATABASE_NAME]
21 | hackathons_collection = db['prev_hackathons']
22 |
23 | # list for testing
24 | # hackathons_collection = []
25 |
26 | options = Options()
27 | # options.add_argument("--window-size=1920x1080")
28 | # options.add_argument("--verbose")
29 | # options.add_argument("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36")
30 | options.add_argument("--headless=new")
31 |
32 | driver = webdriver.Chrome(options=options)
33 |
34 | # getting this month and next month
35 | current_date = date.today()
36 | current_month = current_date.strftime("%b").upper()
37 | next_month = date.today() + timedelta(days=30)
38 | next_month = next_month.strftime("%b").upper()
39 | # print("Current Month:", month)
40 | # print(next_month)
41 |
42 |
43 | def fetch_hacks():
44 | print("Fetching hacks...")
45 | driver.get("https://mlh.io/seasons/2024/events")
46 |
47 | EVENTS = []
48 |
49 | try:
50 | element = WebDriverWait(driver, 20).until(
51 | EC.visibility_of_element_located((By.CLASS_NAME, 'event-wrapper'))
52 | )
53 |
54 | event_wrapper = driver.find_elements(By.CLASS_NAME, "event-wrapper")
55 | except:
56 | print("Cannot load data")
57 |
58 | for event in event_wrapper:
59 | event_name = event.find_element(By.CLASS_NAME, "event-name").text
60 | event_link = event.find_element(By.CLASS_NAME, "event-link").get_attribute("href")
61 | event_mode = event.find_element(By.CLASS_NAME, "event-hybrid-notes").text
62 | event_date = event.find_element(By.CLASS_NAME, "event-date").text
63 |
64 | event_details = [event_name, event_link, event_mode, event_date]
65 | EVENTS.append(event_details)
66 |
67 | return EVENTS
68 |
69 |
70 | def validate_hacks():
71 | all_hacks = fetch_hacks()
72 | new_hacks = []
73 |
74 | print("Validating hacks...")
75 | for event in all_hacks:
76 | # checking if date is this month or next month
77 | if event[3][0:3] == current_month or event[3][0:3] == next_month:
78 | if event not in hackathons_collection:
79 | new_hacks.append(event)
80 |
81 | return new_hacks
82 |
83 | def main():
84 | print("Running...")
85 |
86 | while True:
87 |
88 | try:
89 | new_hacks = validate_hacks()
90 |
91 | if new_hacks:
92 | print("New hacks found on MLH:")
93 |
94 | for hack in new_hacks:
95 | print(hack)
96 | else:
97 | print("No new hacks")
98 | break
99 |
100 | # sending new hackathons to endpoint
101 | ENDPOINT_URL = 'YOUR_ENDPOINT_URL_HERE'
102 | try:
103 | response = requests.post(ENDPOINT_URL, json=new_hacks)
104 | response.raise_for_status() # Raise an exception if the request fails (e.g., 4xx or 5xx status codes)
105 | print("Successfully sent new hackathons to the endpoint.")
106 | except requests.exceptions.RequestException as request_error:
107 | print("Error sending hackathons to the endpoint:", request_error)
108 |
109 | # Insert new hackathons into MongoDB
110 | hackathons_collection.insert_many(new_hacks)
111 |
112 | except Exception as E:
113 | print("Error:", E)
114 | driver.quit()
115 | break
116 |
117 | if __name__ == "__main__":
118 | main()
119 |
120 |
--------------------------------------------------------------------------------
/MyAnimeList/scraper.py:
--------------------------------------------------------------------------------
1 | import requests
2 | from bs4 import BeautifulSoup
3 |
4 | class MALScraper:
5 | def __init__(self, url):
6 | self.url = url
7 |
8 | def scrape_top_anime(self):
9 | response = requests.get(f"{self.url}/topanime.php")
10 |
11 | if response.status_code != 200:
12 | print("Failed to retrieve anime data.")
13 | return []
14 |
15 | soup = BeautifulSoup(response.text, "html.parser")
16 | anime_entries = soup.find_all("tr", class_="ranking-list")
17 |
18 | anime_data = []
19 | for anime_entry in anime_entries:
20 | rank = anime_entry.select_one("td span.lightLink").text.strip()
21 | name = anime_entry.select_one("td div.detail h3 a").text.strip()
22 | score = anime_entry.select_one("td span.text.on.score-label").text.strip()
23 | infos = [info.text.strip() for info in anime_entry.select("td div.detail div.information")]
24 | split_info = infos[0].split('\n')
25 | cleaned_parts = [part.strip() for part in split_info]
26 |
27 | anime_info = (
28 | rank,
29 | name,
30 | score,
31 | cleaned_parts[0],
32 | cleaned_parts[1],
33 | cleaned_parts[2]
34 | )
35 | anime_data.append(anime_info)
36 |
37 | return anime_data
38 |
39 | def scrape_top_manga(self):
40 | response = requests.get(f"{self.url}/topmanga.php")
41 |
42 | if response.status_code != 200:
43 | print("Failed to retrieve manga data.")
44 | return []
45 |
46 | soup = BeautifulSoup(response.text, "html.parser")
47 | manga_entries = soup.find_all("tr", class_="ranking-list")
48 |
49 | manga_data = []
50 | for manga_entry in manga_entries:
51 | rank = manga_entry.select_one("td span.lightLink").text.strip()
52 | name = manga_entry.select_one("td div.detail h3 a").text.strip()
53 | score = manga_entry.select_one("td span.text.on.score-label").text.strip()
54 | infos = [info.text.strip() for info in manga_entry.select("td div.detail div.information")]
55 | split_info = infos[0].split('\n')
56 | cleaned_parts = [part.strip() for part in split_info]
57 |
58 | manga_info = (
59 | rank,
60 | name,
61 | score,
62 | cleaned_parts[0],
63 | cleaned_parts[1],
64 | cleaned_parts[2]
65 | )
66 | manga_data.append(manga_info)
67 |
68 | return manga_data
69 |
70 | def scrape_seasonal_anime(self, year, season):
71 | url = f"{self.url}/anime/season/{year}/{season.lower()}"
72 | response = requests.get(url)
73 |
74 | if response.status_code != 200:
75 | print("Failed to retrieve seasonal anime data.")
76 | return []
77 |
78 | soup = BeautifulSoup(response.text, "html.parser")
79 | anime_entries = soup.find_all("div", class_="seasonal-anime")
80 |
81 | seasonal_anime_data = []
82 | for anime_entry in anime_entries:
83 | title = anime_entry.find("span", class_="js-title").text.strip()
84 | episodes = anime_entry.select_one("div div.prodsrc div.info span.item span").text.strip()
85 | airing = anime_entry.select_one("div div.prodsrc div.info span.item").text.strip()
86 | span_elements = anime_entry.find_all('span', class_="genre")
87 | genre_list = [span.get_text() for span in span_elements]
88 | cleaned_genres = ', '.join(genre.strip() for genre in genre_list)
89 |
90 | anime_info = (
91 | title,
92 | episodes,
93 | airing,
94 | cleaned_genres
95 | )
96 | seasonal_anime_data.append(anime_info)
97 |
98 | return seasonal_anime_data
99 |
100 | def scrape_specific_anime(self, anime_name):
101 | anime_url = f"{self.url}/anime.php?q={anime_name}"
102 | response = requests.get(anime_url)
103 |
104 | if response.status_code != 200:
105 | print("Failed to retrieve specific anime data.")
106 | return []
107 |
108 | soup = BeautifulSoup(response.text, "html.parser")
109 | anime_info = soup.find("div", class_="js-categories-seasonal js-block-list list")
110 | rows = anime_info.find_all('tr')
111 |
112 | specific_anime_data = []
113 | for row in rows[1:2]:
114 | title = row.select_one("td div.title a strong").text.strip()
115 | episodes = anime_info.find("td", class_="borderClass ac bgColor0", width="40").text.strip()
116 | score = anime_info.find("td", class_="borderClass ac bgColor0", width="50").text.strip()
117 | synopsis = anime_info.find("div", class_="pt4").text.strip()
118 |
119 | anime_info = (
120 | title,
121 | episodes,
122 | score,
123 | synopsis
124 | )
125 | specific_anime_data.append(anime_info)
126 |
127 | return specific_anime_data
128 |
--------------------------------------------------------------------------------
/Devpost/main.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | from selenium.webdriver.chrome.options import Options
3 | from selenium.webdriver.common.by import By
4 | from selenium.webdriver.support import expected_conditions as EC
5 | from selenium.webdriver.support.wait import WebDriverWait
6 | from pymongo import MongoClient
7 | from datetime import date, timedelta
8 | from time import sleep
9 | import requests
10 |
11 | # Replace these placeholders with your actual MongoDB URL and database name
12 | MONGODB_URL = 'YOUR MONGODB URL'
13 | DATABASE_NAME = 'YOUR DATABASE NAME'
14 |
15 | # Initialize MongoDB client and database
16 | client = MongoClient(MONGODB_URL)
17 | db = client[DATABASE_NAME]
18 | hackathons_collection = db['prev_hackathons']
19 |
20 |
21 | options = Options()
22 | options.add_argument("--headless=new")
23 | driver = webdriver.Chrome(options=options)
24 |
25 |
26 | # getting this month and next month
27 | current_date = date.today()
28 | current_month = current_date.strftime("%b").upper()
29 | next_month = date.today() + timedelta(days=30)
30 | next_month = next_month.strftime("%b").upper()
31 | # print("Current Month:", current_month)
32 | # print(next_month)
33 |
34 | LINKS= []
35 | TITLES=[]
36 | MODES=[]
37 | DATES=[]
38 | EVENTS=[]
39 |
40 | def fetch_hacks():
41 |
42 | print("Fetching hacks...")
43 | driver.get("https://devpost.com/hackathons")
44 |
45 | # For Scrolling
46 | for x in range(0, 10):
47 | driver.execute_script("window.scrollBy(0, document.body.scrollHeight)")
48 | sleep(1)
49 | driver.execute_script("window.scrollBy(0,-300)")
50 |
51 |
52 |
53 | try:
54 |
55 | elements = WebDriverWait(driver, 20).until(EC.presence_of_element_located((By.ID, 'container')))
56 |
57 | # hackathon_box = driver.find_elements(By.CLASS_NAME, "hackathon-tile clearfix open mb-5")
58 | main_content = driver.find_elements(By.CLASS_NAME, 'main-content')
59 | # side_content = driver.find_elements(By.CLASS_NAME, 'info')
60 |
61 | hackathons_container = driver.find_elements(By.CLASS_NAME,'hackathons-container')
62 |
63 |
64 | except:
65 | print("Cannot load data")
66 |
67 |
68 | def removeduplicate(data):
69 | countdict = {}
70 | for element in data:
71 | if element in countdict.keys():
72 | countdict[element] += 1
73 | else:
74 | countdict[element] = 1
75 | data.clear()
76 | for key in countdict.keys():
77 | data.append(key)
78 |
79 | for box in hackathons_container:
80 | links = box.find_elements(By.TAG_NAME, 'a')
81 |
82 | for link in links:
83 | LINKS.append(link.get_attribute('href'))
84 |
85 |
86 |
87 | for hackathon in main_content:
88 | title = hackathon.find_element(By.TAG_NAME, 'h3').text
89 | TITLES.append(title)
90 |
91 |
92 | mode = hackathon.find_element(By.CLASS_NAME,'info').text
93 | MODES.append(mode)
94 |
95 |
96 | date = hackathon.find_element(By.CLASS_NAME, 'submission-period').text
97 | DATES.append(date)
98 |
99 | removeduplicate(LINKS)
100 |
101 |
102 | for i in range( 0, len(LINKS)):
103 |
104 | event_details = [ TITLES[i], LINKS[i], MODES[i], DATES[i] ]
105 | EVENTS.append(event_details)
106 |
107 |
108 |
109 | print(len(DATES))
110 | return EVENTS
111 |
112 |
113 |
114 |
115 |
116 |
117 | def validate_hacks():
118 | all_hacks = fetch_hacks()
119 | new_hacks = []
120 |
121 | print("Validating hacks...")
122 | for event in all_hacks:
123 | # checking if date is this month or next month
124 |
125 | hack_month = event[3][0:3].upper()
126 | print(hack_month)
127 | if hack_month == current_month or hack_month == next_month:
128 | if event not in hackathons_collection:
129 | new_hacks.append(event)
130 |
131 |
132 | return new_hacks
133 |
134 |
135 | def main():
136 |
137 |
138 |
139 | print("Running...")
140 |
141 | while True:
142 |
143 | try:
144 | new_hacks = validate_hacks()
145 |
146 | if new_hacks:
147 | print("New hacks found on Devpost:")
148 |
149 | for hack in new_hacks:
150 | print(hack)
151 | else:
152 | print("No new hacks")
153 | break
154 |
155 | # sending new hackathons to endpoint
156 | ENDPOINT_URL = 'YOUR_ENDPOINT_URL_HERE'
157 | try:
158 | response = requests.post(ENDPOINT_URL, json=new_hacks)
159 | response.raise_for_status() # Raise an exception if the request fails (e.g., 4xx or 5xx status codes)
160 | print("Successfully sent new hackathons to the endpoint.")
161 | except requests.exceptions.RequestException as request_error:
162 | print("Error sending hackathons to the endpoint:", request_error)
163 |
164 | # Insert new hackathons into MongoDB
165 | hackathons_collection.insert_many(new_hacks)
166 |
167 | except Exception as E:
168 | print("Error:", E)
169 | driver.quit()
170 | break
171 |
172 |
173 | if __name__ == "__main__":
174 | main()
175 |
176 |
177 |
178 |
179 |
--------------------------------------------------------------------------------
/Devfolio/main.py:
--------------------------------------------------------------------------------
1 | import aiohttp
2 | import asyncio
3 | import logging
4 | import os
5 | from pymongo import MongoClient
6 | from datetime import datetime
7 | from lxml import html
8 |
9 | class EventScraper:
10 | def __init__(self, db_uri, db_name, endpoint_url):
11 | # Initialize MongoDB client and database
12 | self.client = MongoClient(db_uri)
13 | self.db = self.client[db_name]
14 | self.hackathons_collection = self.db['prev_hackathons']
15 | self.endpoint_url = endpoint_url
16 |
17 | async def fetch_hackathons(self, url):
18 | try:
19 | async with aiohttp.ClientSession() as session:
20 | async with session.get(url) as response:
21 | response.raise_for_status()
22 | content = await response.text()
23 |
24 | doc = html.fromstring(content)
25 |
26 | # Extracting hackathons data
27 | hackathons = []
28 | hackathon_elements = doc.xpath('//div[@class="sc-xyzabc"]') # Replace with the actual XPath
29 |
30 | for element in hackathon_elements:
31 | title = element.xpath('.//h3[@class="hackathon-title"]/text()')
32 | link = element.xpath('.//button[@class="sc-iXxrte bRawMo"]/@href')
33 | mode = element.xpath('.//p[@class="hackathon-mode"]/text()')
34 | date = element.xpath('.//div[@class="hackathon-date"]/text()')
35 |
36 | if title and link and mode and date:
37 | hackathon_info = {
38 | "title": title[0].strip(),
39 | "link": link[0].strip(),
40 | "mode": mode[0].strip(),
41 | "Date": date[0].strip()
42 | }
43 | hackathons.append(hackathon_info)
44 |
45 | return hackathons
46 |
47 | except (aiohttp.ClientError, aiohttp.ClientConnectorError) as e:
48 | logging.error(f"Error fetching hackathons: {e}")
49 | return []
50 |
51 | async def send_hackathons_to_endpoint(self, hackathons):
52 | try:
53 | async with aiohttp.ClientSession() as session:
54 | async with session.post(self.endpoint_url, json=hackathons) as response:
55 | response.raise_for_status()
56 | logging.info("Successfully sent new hackathons to the endpoint.")
57 | except aiohttp.ClientError as e:
58 | logging.error(f"Error sending hackathons to the endpoint: {e}")
59 |
60 | def validate_hackathon_data(self, hackathon):
61 | # Implement data validation logic here
62 | # For example, you can check if certain fields are not empty or meet specific criteria
63 | if hackathon["title"] and hackathon["link"] and hackathon["mode"] and hackathon["Date"]:
64 | return True
65 | return False
66 |
67 | async def run(self):
68 | logging.info("Running...")
69 |
70 | while True:
71 | try:
72 | hackathons = await self.fetch_hackathons('https://devfolio.co/hackathons')
73 |
74 | # Check for new hackathons and validate them
75 | new_hackathons = [hackathon for hackathon in hackathons if
76 | self.validate_hackathon_data(hackathon) and
77 | not self.hackathons_collection.find_one({"title": hackathon["title"]})]
78 |
79 | if new_hackathons:
80 | logging.info("New hackathons found:")
81 | for hackathon in new_hackathons:
82 | pass # Specific actions for new hackathons can be added here
83 | logging.info(new_hackathons)
84 |
85 | # Send new hackathons to an endpoint asynchronously
86 | await self.send_hackathons_to_endpoint(new_hackathons)
87 |
88 | # Insert new hackathons into MongoDB
89 | self.hackathons_collection.insert_many(new_hackathons)
90 |
91 | else:
92 | logging.info("No new updates")
93 |
94 | except Exception as e:
95 | logging.error(f"Error: {e}")
96 | notice = {"title": "Bot Down", "link": "", "mode": "", "Date": datetime.now().isoformat()}
97 | try:
98 | await self.send_hackathons_to_endpoint(notice)
99 | logging.info("Successfully sent notice to the endpoint.")
100 | except aiohttp.ClientError as e:
101 | logging.error(f"Error sending notice to the endpoint: {e}")
102 |
103 | await asyncio.sleep(600) # Sleep for 10 minutes (adjust as needed)
104 |
105 | if __name__ == "__main__":
106 | # Replace with your MongoDB URI, database name, and endpoint URL
107 | db_uri = 'mongodb://your_username:your_password@localhost:27017'
108 | db_name = 'hackathons_db'
109 | endpoint_url = 'http://localhost:8000/api/hackathons'
110 |
111 | event_scraper = EventScraper(db_uri, db_name, endpoint_url)
112 |
113 | loop = asyncio.get_event_loop()
114 | loop.run_until_complete(event_scraper.run())
115 |
--------------------------------------------------------------------------------
/unstop/UNSTOP.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | from time import sleep
3 | from selenium.webdriver.common.keys import Keys
4 | from selenium.webdriver.chrome.options import Options
5 | from selenium.webdriver.common.by import By
6 | from pymongo import MongoClient
7 | import requests
8 |
9 |
10 | MONGODB_URL = 'YOUR_MONGODB_URL_HERE'
11 | DATABASE_NAME = 'YOUR_DATABASE_NAME_HERE'
12 |
13 | client = MongoClient(MONGODB_URL)
14 | db = client[DATABASE_NAME]
15 | hackathons_collection = db['prev_hackathons']
16 | # hackathons_collection = []
17 | path = r"E:\dd\chromedriver-win64\chromedriver-win64\chromedriver.exe" #set path for web driver
18 | options = Options()
19 | # options.add_argument("--window-size=1920x1080")
20 | # options.add_argument("--verbose")
21 | options.add_argument("--headless=new") #implementing headless to work without extra window
22 | browser = webdriver.Chrome(executable_path=path,options=options)
23 |
24 | browser.get("https://unstop.com/hackathons")
25 |
26 |
27 | def extract_name(list1,list2): #substrating the string containing all the details from the string containing place
28 | res = [ ele for ele in list1 ]
29 | for a in list2:
30 | if a in list1:
31 | res.remove(a) #name+place - place = name
32 | return res
33 |
34 |
35 | def find_hacks(): # function to extract hackathons from unstop
36 |
37 | hackathons = []
38 |
39 | # try:
40 |
41 | hack_xpath = "//div[@class='content']"
42 |
43 | hackathons = []
44 |
45 | hack_list = browser.find_elements(By.XPATH,hack_xpath)
46 | # for p in hack_list:
47 | # print(p.text)
48 | for hack in hack_list:
49 | hack.click()
50 | sleep(1)
51 |
52 | try: #dealing with the login pop up
53 | sleep(10)
54 | login_up = browser.find_element(By.XPATH,"//div[@class='bg_box login_modal']")
55 | close = browser.find_element(By.XPATH,"//em[@class ='material-icons close_icon gtm_modal_close_btn ng-star-inserted']")
56 | close.click()
57 | sleep(1)
58 |
59 | except:
60 | pass
61 |
62 | try: # dealing with the accept cookies pop up
63 | sleep(1)
64 | cookies = browser.find_element_by_xpath("//div[@class='box_right_bottom site-update ng-star-inserted']")
65 | ok_but = browser.find_element_by_xpath("//div[@class='desk']")
66 | ok_but.click()
67 | sleep(1)
68 | except:
69 | pass
70 | isopen = browser.find_element(By.XPATH,"//div[@class='register_sect ng-star-inserted']")
71 |
72 | for x in isopen.text.split():
73 |
74 | if x == "Register": #checking if the registration of certain hackathon is still there or closed
75 | reg_open = True
76 | break
77 | else:
78 | reg_open = False
79 |
80 | if reg_open == True:
81 | hack_overall = browser.find_element(By.CSS_SELECTOR,"div[class='cptn 456']>h1") #scraping name and place
82 | hack_place = browser.find_element(By.CSS_SELECTOR,"div[class='cptn 456']>h1>span") #scraping place
83 | hack_mode = browser.find_element(By.CSS_SELECTOR,"div[class='items ml-10 single-wrap']")#scraping mode of hackathon
84 | hack_overall_list = hack_overall.text.split()
85 | hack_name_list = hack_place.text.split()
86 |
87 | hack_name_l = extract_name(hack_overall_list,hack_name_list)
88 |
89 | hack_name = ""
90 |
91 | for x in hack_name_l:
92 | hack_name += x+" " #convertign list containing hackathon name into string
93 |
94 | hack_link = browser.find_element(By.XPATH,"//a[@class='register_btn cursor waves-effect ng-star-inserted']").get_attribute("href") #scraping link of hackthon registration
95 |
96 | details_list = isopen.text.split()
97 | price = details_list[0] #scraping price of entry or hackathon
98 |
99 | hackathons.append([hack_name,hack_place.text,hack_mode.text,hack_link,price])
100 |
101 |
102 | else:
103 | continue
104 | return hackathons
105 |
106 |
107 | def validate_hacks(): #filtering the new hackathons
108 | all_hacks = find_hacks()
109 | new_hacks = []
110 |
111 | print("Validating hacks...")
112 | for event in all_hacks:
113 |
114 |
115 | if event not in hackathons_collection:
116 | new_hacks.append(event)
117 | return new_hacks
118 |
119 |
120 | def main(): #main program
121 | print("Running...")
122 |
123 | while True:
124 |
125 | try:
126 | new_hacks = validate_hacks()
127 | # print(new_hacks)
128 |
129 | if new_hacks:
130 | print("New hacks found on unpost:")
131 |
132 | for hack in new_hacks:
133 | print(hack)
134 | else:
135 | print("No new hacks")
136 | break
137 |
138 | # sending new hackathons to endpoint
139 | ENDPOINT_URL = 'YOUR_ENDPOINT_URL_HERE'
140 | try:
141 | response = requests.post(ENDPOINT_URL, json=new_hacks)
142 | response.raise_for_status() # Raise an exception if the request fails (e.g., 4xx or 5xx status codes)
143 | print("Successfully sent new hackathons to the endpoint.")
144 | except requests.exceptions.RequestException as request_error:
145 | print("Error sending hackathons to the endpoint:", request_error)
146 |
147 | # Insert new hackathons into MongoDB
148 | hackathons_collection.insert_many(new_hacks)
149 |
150 | except Exception as E:
151 | print("Error:", E)
152 | browser.quit()
153 | break
154 |
155 | if __name__ == "__main__":
156 | main()
157 |
158 |
159 |
160 |
161 |
162 |
--------------------------------------------------------------------------------
/Internshala/internshala.js:
--------------------------------------------------------------------------------
1 | const axios = require('axios');
2 | const cheerio = require('cheerio');
3 |
4 | class Internshala {
5 | constructor(search_type) {
6 | this.base_url = 'https://internshala.com/';
7 | this.search_type = search_type;
8 | }
9 |
10 | async __scrape_page(url) {
11 | try {
12 | const response = await axios.get(url);
13 | return response.data;
14 | } catch (error) {
15 | throw new Error(`An error occurred while fetching the page: ${error.message}`);
16 | }
17 | }
18 |
19 | __parse_page(html) {
20 | try {
21 | return cheerio.load(html);
22 | } catch (error) {
23 | throw new Error(`An error occurred while parsing the page: ${error.message}`);
24 | }
25 | }
26 |
27 | async internships() {
28 | try {
29 | this.search_type = this.search_type.replace(' ', '%20');
30 | const url = `${this.base_url}internships/keywords-${this.search_type}`;
31 | const html = await this.__scrape_page(url);
32 | const page = this.__parse_page(html);
33 | const internships = [];
34 |
35 | const internships_container = page('.individual_internship');
36 |
37 | if (!internships_container.length) {
38 | return { message: 'No internships found' };
39 | } else {
40 | internships_container.each((index, element) => {
41 | const title = page(element).find('.heading_4_5.profile').text().trim();
42 | const company = page(element).find('.heading_6.company_name').text().trim();
43 | const location = page(element).find('a.location_link').text().trim();
44 | const other_details = page(element).find('.item_body');
45 | const duration = other_details.length > 2 ? other_details.eq(1).text().trim() : 'N/A';
46 | const stipend_element = page(element).find('.stipend');
47 | const stipend = stipend_element.length ? stipend_element.text().trim() : 'N/A';
48 |
49 | const internship_data = {
50 | title,
51 | company,
52 | location,
53 | duration,
54 | stipend,
55 | };
56 |
57 | internships.push(internship_data);
58 | });
59 |
60 | return {
61 | data: internships,
62 | message: 'Internships are now fetched',
63 | };
64 | }
65 | } catch (error) {
66 | throw new Error(`An error occurred while scraping internships: ${error.message}`);
67 | }
68 | }
69 |
70 | async jobs() {
71 | try {
72 | this.search_type = this.search_type.replace(' ', '%20');
73 | const url = `${this.base_url}jobs/keywords-${this.search_type}`;
74 | const html = await this.__scrape_page(url);
75 | const page = this.__parse_page(html);
76 | const jobs = [];
77 |
78 | const jobs_container = page('#internship_list_container_1');
79 |
80 | if (!jobs_container.text()) {
81 | return { message: 'No jobs found' };
82 | } else {
83 | jobs_container.find('.container-fluid.individual_internship.visibilityTrackerItem').each((index, item) => {
84 | const title = page(item).find('.heading_4_5.profile').text().trim();
85 | const company = page(item).find('.heading_6.company_name').text().trim();
86 | const location = page(item).find('p#location_names').text().trim();
87 | const ctc = page(item).find('.item_body.salary').text().trim();
88 | const experience = page(item).find('.item_body.desktop-text').text().trim().split(' ')[0];
89 |
90 | const job_data = {
91 | title,
92 | company,
93 | location,
94 | CTC: ctc,
95 | 'experience(in years)': experience,
96 | };
97 |
98 | jobs.push(job_data);
99 | });
100 |
101 | return {
102 | data: jobs,
103 | message: 'Jobs are now fetched',
104 | };
105 | }
106 | } catch (error) {
107 | throw new Error(`An error occurred while scraping jobs: ${error.message}`);
108 | }
109 | }
110 |
111 | async certification_courses() {
112 | try {
113 | const url = this.base_url;
114 | const html = await this.__scrape_page(url);
115 | const page = this.__parse_page(html);
116 | const certification_courses = [];
117 |
118 | const certification_section = page('.certification-trainings-section');
119 |
120 | if (certification_section.length) {
121 | certification_section.find('.card').each((index, card) => {
122 | const title_element = page(card).find('h6');
123 | const duration_element = page(card).find('span.duration');
124 | const rating_element = page(card).find('span.rating');
125 | const learners_element = page(card).find('span.learners');
126 | const link_element = page(card).find('a');
127 |
128 | const title = title_element.text().trim() || null;
129 | const duration = duration_element.text().trim() || null;
130 | const rating = rating_element.text().trim() || null;
131 | const learners = learners_element.text().trim() || null;
132 | const link = link_element.attr('href') || null;
133 |
134 | if (title && duration && rating && learners && link) {
135 | const certification_data = {
136 | title,
137 | duration,
138 | rating,
139 | learners,
140 | link,
141 | };
142 | certification_courses.push(certification_data);
143 | }
144 | });
145 |
146 | return certification_courses;
147 | } else {
148 | return null;
149 | }
150 | } catch (error) {
151 | return null;
152 | }
153 | }
154 | }
155 |
156 | // Example usage:
157 | const search = new Internshala('web development');
158 | search.internships()
159 | .then(result => console.log(result))
160 | .catch(error => console.error(error));
161 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------