从Nairaland获取和解析数据。

nairaland的Python项目详细描述


从Nairaland获取和解析数据的Python模块。在

目录

安装

您需要Python 3.x和{a6}。在

使用pip安装:pip install nairaland 通过回购安装:

  • 克隆报告git clone https://github.com/makinde2013/pynairaland
  • 通过pip install -r requirements.txt
  • 将pynairaland放在项目根文件夹中

用法

用户统计

fromnairalandimportNairalandimportosfromnairaland.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)

经过身份验证的用户路由

^{pr2}$

特点

目前已实施

  • 头版主题
  • 最近的主题
  • 趋势话题
  • 最新帖子(评论)
  • 类别
  • 类别主题
  • 用户配置文件
  • 用户帖子
  • 用户主题
  • 用户跟踪板
  • 用户关注的主题
  • 用户关注的帖子
  • 共享给用户的帖子
  • 搜索
  • 创建主题
  • 用引号创建帖子(评论)
  • 喜欢/不喜欢帖子(评论)
  • 共享/取消共享帖子(评论)

待办事项

  • 单元测试
  • 重构代码使其干燥

贡献

检查一下GitHub上的问题和/或发出请求以供贡献!在

{id10}$

使用pynairaland

的项目

确认条款

  • 我把这个项目当成了锅炉板。在

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
ws-consumer服务地址中的java动态属性   java如何比较整数列表,然后按升序排序?   javascript我正在使用java脚本调用一个函数,但它没有调用代码下面的方法,也没有调用secretitnames()函数   在文本窗格中多次使用Java insertIcon图标   JavaMSAL安卓。AuthenticationActivity完成,但用于身份验证请求的线程池线程仍处于等待状态   if语句中的java多范围比较   java toString()表示输出   java如何在jcstrest测试中生成指令重新排序   java我怎样才能运行它?   web应用程序中使用Hibernate和Spring的java问题   如何将字符串数据写入Java文本文件   如何在java命令提示符下运行已签名的jar文件?   java从我的菜单调用RCP应用程序   java如何等待Canvas/GraphicsContext完成任务,然后再继续执行代码块?