Skip to content

This is a program to scraping the site "howlongtobeat.com"

License

Notifications You must be signed in to change notification settings

MaxwellFB/Scraping-HowLongToBeat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scraping-HowLongToBeat

This is a program to scraping the site "howlongtobeat.com". It is only necessary to inform the name of the game that you wish collect information and the program will return almost all data available in the site.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

Libraries:

  • BeautifulSoup v4.9.1
  • Requests v2.22.0

Installing

To install you can download manually from GitHub or run the following command:

git clone https://github.com/MaxwellFB/Scraping-HowLongToBeat.git

Running

First we need to import the main class called HowLongToBeat

from howlongtobeat import HowLongToBeat

And initialize

hltb = HowLongToBeat()

Searching a game

To search a game is necessary to use the complete name of the game. The following example we are searching about "Dark Souls III". Don't worry about sensitive case :)

result = hltb.search_game('dark souls iii')

Return game found

If the game we are searching be found all data collect will be stored in the class "HowLongToBeatData" that we can access using the follow command:

result.[data_name]

Let's get the 'developer':

result.developer
'From Software'

To check all information collected from the game we can use the follow command:

result.__dict__

Normally the games don't have all information that we collect because don't exist for that game or nobody submitted yet. These information will be classified as:

None

Return game not found

The program looks for the game with the same name that we typed, if you look in the site "howlongtobeat.com" when we search a game using the full name the results list will show an option with a green name.

HowLongToBeat Green Name

If the name typed don't result an option with a green name the return will be:

False

Store time

To store time, was created a class. where we can store and collect what we wish.

If we type only the name we receive a complete time text:

result.main_story_time
32 hours 30 minutes 0 seconds

To collect only the hour, minutes or seconds:

result.main_story_time.hours
32
result.main_story_time.minutes
30
result.main_story_time.seconds
0

Contributing

If you have suggestions, found bug, or something wrong. Don't be shy, tell me using the issue or submitting pull requests.

Versioning

We use SemVer for versioning.

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

About

This is a program to scraping the site "howlongtobeat.com"

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages