Package: nairaland
A Python module to fetch and parse data from Nairaland.Table of ContentsInstallationUsageFeaturesContributeProjects using ``pynairaland`<#projects-using-pynairaland>`_InstallationYou will needPython 3.xandpip.Install using pip:pip install nairalandInstall via repo:Clone reporgit clonehttps://github.com/makinde2013/pynairalandInstall requirements viapip install-rrequirements.txtPlace pynairaland in your project root folderUsageUser statisticsfromnairalandimportNairalandimportosfromnairaland.browserimportBrowserbrowser=Browser(os.getenv('LINUX'))nairaland=Nairaland(browser)# Get front page topicsfront_page_topics=nairaland.front_page_topics()# Do stuff with the parsed activity dataprint(front_page_topics)# Get categoriescategories=nairaland.categories(depth=2)# Get category topicscategory_topics=nairaland.category_topics(category='politics',page=2)# categories are:{"data":[{"id":"9","name":"Nairaland / General","sub_categories":[],"title":" class=g","url":"https://nairaland.com/nairaland"},{"id":"12","name":"Entertainment","sub_categories":[],"title":"Entertainment threads that won't fit into any child board. class=g","url":"https://nairaland.com/entertainment"},{"id":"8","name":"Science/Technology","sub_categories":[],"title":" class=g","url":"https://nairaland.com/science"}]}# Get trending topicstopics_trending=nairaland.topics_trending(page=2)# Get latest topicslatest_topics=nairaland.new_topics(page=2)# Get latest commentslatest_comments=nairaland.recent_posts(page=2)# Get user profileuser_profile=nairaland.recent_posts(user='bolaji21',page=2)# Get user postsuser_posts=nairaland.user_posts(user='bolaji21',page=2)# Get user topicsuser_topics=nairaland.user_topics(user='bolaji21',page=2)# Get topic (thread) commentstopic_comments=nairaland.topic_posts(topic='5426482',page=2)# comments are:{"data":[{"content":"It was a battle of Zanku supremacy between Tiwa Savage and famous dancer, Poco Lee at Tiwa’s “49-99” premiere party in Obalende, Lagos.On the 17th of September would be a day to remember for some music fans as Tiwa Savage took her bubbly self and her team to entertain Lagosians for free at the very busy area of Obalende on a sunny afternoon. While the crowd that was present for the show was expecting to catch a glimpse of Tiwa Savage on stage performing her rcently released song, they got more than they had hoped for as Tiwa and Poco Lee did something that was similar to a face-off as they showed some really dope Zanku moves.Tiwa never shied away from Poco Lee’s sleek moves and she gave some really unique moves too. Watch the video below and judge who did better with the dance: https://www.youtube.com/watch?v=mkSz8mq0xfQ.https://www.thenaijafame.com.ng/2019/09/watch-tiwa-savage-battle-poco-lee-on.html?m=1","date_posted":"2019-09-19 20:51:00","likes":0,"shares":0,"user":{"name":"Chinekepikin","url":"https://nairaland.com/chinekepikin"}},{"content":"More, Watch The Full Video HERE","date_posted":"2019-09-19 20:52:00","likes":0,"shares":0,"user":{"name":"Chinekepikin","url":"https://nairaland.com/chinekepikin"}}],"meta":{"next_page":1,"page":0,"per_page":36,"previous_page":0,"total_entries":144,"total_pages":4},"topic":{"category":{"name":"Celebrities","url":"https://www.nairaland.com/celebs"},"id":"5426482","title":"Tiwa Savage Battles Poco Lee On Stage For Zanku Supremacy (Video)"}}# search for posts containing keywordsearch_results=nairaland.search(search_term='buhari',board=20,page=1)Authenticated user routesimportosfromnairalandimportUserfromnairaland.browserimportBrowserbrowser=Browser(os.getenv('LINUX'))user=User(browser)# Get user followed topicsfollowed_topics=user.followed_topics(page=2)# Get user followed boardsfollowed_boards=user.followed_boards(page=2)# Get user mentionsmentions=user.mentions(page=2)# topics are:{"data":[{"creator":{"name":"Seun","url":"https://nairaland.com/seun"},"id":"2792995","last_post_creator":{"name":"Youthleader22","url":"https://nairaland.com/youthleader22"},"last_post_time":"2019-09-17 18:44:00","posts":"3783","title":"Nairaland Says No To Secessionists","url":"https://nairaland.com/2792995/nairaland-says-no-secessionists","views":"410717"},{"creator":{"name":"ItoroUdotim","url":"https://nairaland.com/itoroudotim"},"id":"5425882","last_post_creator":{"name":"wiseone28","url":"https://nairaland.com/wiseone28"},"last_post_time":"2019-09-19 22:45:00","posts":"29","title":"Governor Udom Emmanuel Wins At Tribunal","url":"https://nairaland.com/5425882/governor-udom-emmanuel-wins-tribunal","views":"6699"}],"meta":{"next_page":1,"page":0,"per_page":64,"previous_page":0,"total_entries":640,"total_pages":10}}FeaturesCurrently implementedFront page topicsRecent topicsTrending topicsLatest posts (comments)CategoriesCategory topicsUser ProfileUser postsUser TopicsUser followed boardsUser followed topicsPosts by who user is followingPosts shared to userSearchCreate topicCreate post (comment) with quoteLike/Unlike post (comment)Share/Unshare post (comment)To doUnit testRefactor code to make it DRYContributeCheck out the issues on GitHub and/or make a pull request to contribute!Projects usingpynairaland``nairaland-api`<https://github.com/makinde2013/nairaland-api>`_ – A REST API for Nairaland.Acknowledegment``pyquora`<https://github.com/csu/pyquora>`_ – The project served as boiler plate for me to get this ready.