Newgrounds flash game scraper powered by bs4 and requests
Project description
NGScrape
Newgrounds game scraper made with beautifulsoup4 and requestslib.
NGScrape is licensed under the GNU Affero General Public License v3.0. If a copy is not included with this file, you can find one at https://www.gnu.org/licenses/agpl-3.0.en.html.
Please star is this was useful!
Functions:
__init__(debug: bool = False) -> None
- Start a new NGScrape Instance.
- Parameters:
- debug (bool) = False: Enable/Disable debug mode
- cache (bool) = False: Enable/Disable caching
scrape_game_by_url(url: str, download: str, filename: str) -> None
- Scrape a flash game by url.
- Parameters:
- url (str): The URL of the flash game. For example, the URL for Alien Homonid is
https://www.newgrounds.com/portal/view/59593
. - download (str): The directory to download the file to.
- filename (str): The name of the downloaded file.
- url (str): The URL of the flash game. For example, the URL for Alien Homonid is
- Example parameters:
url = 'https://www.newgrounds.com/portal/view/59593'
download = 'testdir'
filename = 'game.swf'
- Example output with debug mode:
- NGScrape: Made request to
https://www.newgrounds.com/portal/view/59593
and got status code200
- NGScrape: Found flash game link
https:\/\/uploads.ungrounded.net\/59000\/59593_alien_booya.swf?f1101313499
- NGScrape: Downloaded swf file to testdir/game.swf
- NGScrape: Made request to
scrape_desc_by_url(self, url: str) -> str
- Scrape a flash game's description by url. Returns the description of the game.
- Parameters:
- url (str): The URL of the flash game. For example, the URL for Alien Homonid is
https://www.newgrounds.com/portal/view/59593
.
- url (str): The URL of the flash game. For example, the URL for Alien Homonid is
- Example parameters:
url = 'https://www.newgrounds.com/portal/view/59593'
- Example output with debug mode:
- NGScrape: Made request to
https://www.newgrounds.com/portal/view/59593
and got status code200
- NGScrape: Found game description "Blast FBI agents in this Metal Slug style shooter!"
- NGScrape: Made request to
scrape_card_by_url(self, url: str, download: str, filename: str) -> str
- Scrape a flash game's card by url. The file extention will be automatically determined. Returns the name of the card file.
- Parameters:
- url (str): The URL of the flash game. For example, the URL for Alien Homonid is
https://www.newgrounds.com/portal/view/59593
. - download (str): The directory to download the file to.
- filename (str): The name of the downloaded file. The file extention will be automatically determined.
- url (str): The URL of the flash game. For example, the URL for Alien Homonid is
- Example parameters:
url = 'https://www.newgrounds.com/portal/view/59593'
download = 'testdir'
filename = 'card'
- Example output with debug mode:
- NGScrape: Made request to
https://www.newgrounds.com/portal/view/59593
and got status code200
- NGScrape: Found card link
https://picon.ngfiles.com/59000/flash_59593_card.png?f1607717241
- NGScrape: Downloaded
png
file totestdir/card.png
- NGScrape: Made request to
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ngscrape-1.3.0.tar.gz
(40.2 kB
view details)
Built Distribution
ngscrape-1.3.0-py3-none-any.whl
(28.5 kB
view details)
File details
Details for the file ngscrape-1.3.0.tar.gz
.
File metadata
- Download URL: ngscrape-1.3.0.tar.gz
- Upload date:
- Size: 40.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e11fea6f2bfd9fbfb605a0b950c72905e5891bc8c91a9a785849eddb3efd0f9d |
|
MD5 | 6ea09e9bef64ea62eadc1e8e6168b4bd |
|
BLAKE2b-256 | 4ca56bd2264db49ef832353b90e4093254b860fe6daee7bb1f0b992fc22bbeb0 |
File details
Details for the file ngscrape-1.3.0-py3-none-any.whl
.
File metadata
- Download URL: ngscrape-1.3.0-py3-none-any.whl
- Upload date:
- Size: 28.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dfbf1baaf780cbc6e522d5a929b31677c196a6a593e719c0c77b6e133ea6b1e8 |
|
MD5 | 54cbbfbdb184ff267e3e02825d70231b |
|
BLAKE2b-256 | d1f856c114d676f18e72d868fed26fcd7059e54adb68fcd6e746bdbee1aeba1b |