Package: weheartpy
weheartpyA fast, reliable API client for WeHeartIt.Descriptionweheartpy is an unofficial API client forweheartitWeHeartItdoes not have an API. So I have to make use ofBeautifulSoupandrequeststo do my job. The speed is optimal, it has a limitation on number of results you can retreive through one search but its functional.RequirementsrequiresPython 3.10or greater.read the requirementshereyou can easily install the packages usingpipInstallationpip install weheartpyorpip install git+https://github.com/aswinnnn/weheartpy.gitFeatureswith weheartpy, you can search for:posts aka entriescollections (including images inside them)userspopular entriesI'm adding more functionalities and utilities later on,
but this is all we got for now.Usagethis is the most basic usage of the weheartpy module.# import the main classfromweheartpyimportWeHeartItwhi=WeHeartIt()# create an instance of WeHeartItentries=whi.popular()# returns a list of recent popular images from homepage.forentryinentries:print(entry.image,entry.views,entry.creator.username)# view the entry's contentsprint(entry.hearts,entry.title)entry.save("\images\cool_pic_from_weheartit.jpeg")# save the image from the post locally.parameters - Nonereturns - List[Entry] a list ofEntryobjects which help you access the entries easier.errors -ConnectionErrorPosts / Entriessearch for entries.entries=whi.search_entries("mean girls",sort="most_popular")# returns a list of entries relevant to your query.forentryinentries:print(entry.username,entry.image,entry.url)parameters -query- your search queryreturns - List[Entry] a list ofEntryobjects which help you access the entries easier.errors -ConnectionErrorCollections# return a list of `Collection` objects resulting from the query.fromweheartpyimportWeHeartItwhi=WeHeartIt()cocs=whi.search_collections("anime pfp")forcincocs:print(c.title,c.link)collection=c.get_full_collection()print(collection.images,collection.description)# save the images from a collection to a folder:collection.save("\collection\")# images will be saved as "collection0.jpeg", "collection1.jpeg", etc.parameters -queryaka the search termreturns - List[Collection] Check out the documentation to see what else you can do withCollectionobjects.errors -NoCollectionsFoundDocumentationcheck out thedocumentationfor more usages.If you'd like to add something or fix mistakes, feel free to open an issue or a pull request.Updatesv0.2.3- usinguser-agenthas been made default. Fixed major bug insearch_entriesso you might wanna update to this version to use that correctly.v0.2.2- Big update, the library uses weheartit's natural API to bringEntrydata.this features a whole new ton of information you can use from entries such as a views, hearts, tags, titles and creation dates.It also includes a.creatorattribute which is aUserobject of the creator of the post.If you notice anything slow, its the API calls to weheartit.com. The IO time can be a pain if you have slow internet, nothing I can fix on my side.v0.2.1- Implement save feature, lets users save images locally.DisclaimerSince this makeshift API client's some modules rely on the websites elements to remain unchanged, expect this package to break easily.This package, code or software is made for educational purposes and does not intend to break any ToS of weheartit.com. The creator/maintainer of this package will not be responsible for any actions done using the code. Use with your own caution and volition.