Git Product home page Git Product logo

Comments (5)

mouwumou avatar mouwumou commented on May 21, 2024

还有一个最新发现的问题,Url2Html中run函数在内容删除或者侵权时,account值为NoneType,而源码中没有处理的方法,并且会在305行报错TypeError

from wechat_articles_spider.

wnma3mz avatar wnma3mz commented on May 21, 2024

首先感谢分享!

在运行代码的时候发现utils.py第189行timestamp2date(dt)报错,缺少一个格式化输入。阅读源码后认为这段代码可以删去,或者给定一个日期格式化,否则会在爬取第一轮(10次)的时候报错中断,删去这行代码后代码运行正常。

此外,给出的demo test_GetUrls.py中,84-88行中的url并没有定义(不过可能就是这样写防小白的?) 第27行item=line赋值可以删去,第24行改为 for i, line in enumerate(lst, 0): 同时,第56行需要判断flag是否为1,而这时会报错flag没有定义。应在前面定义flag函数,如在24行加入flag = 0

根据get_history_urls返回的数据格式,应在24行lst遍历前,加入一个遍历,如: def demo(lst_list): fj = "" item_lst = [] flag = 0 for lst in lst_list: for i, item in enumerate(lst, 0): 这样在demo中才能正确读取传入的数据,否则会报错。

还有源码53-54行的 finally: save_xlsx(fj, item_lst) 可以删去

感谢代码的分享,节省了很多造轮子的功夫。

  1. timestamp2date这个函数我确认了一下,应该是没问题的,不明白中断报错的点在哪里?方便可以把报错信息贴一下。
  2. 84-88行的链接没有贴出来的原因是,每个公众号的信息不一样。比如抓取A公众号的文章,贴的B公众号链接是不行的。见README中的联系注意事项,第三条
  3. demo这个函数在一开始就说明了仅供参考,出问题是因为,后续做了一些调整,没法保证时时都可用。如果您时间充裕,欢迎提交PR。
    # 抓取示例,供参考,不保证有效

from wechat_articles_spider.

wnma3mz avatar wnma3mz commented on May 21, 2024

还有一个最新发现的问题,Url2Html中run函数在内容删除或者侵权时,account值为NoneType,而源码中没有处理的方法,并且会在305行报错TypeError

感谢提醒,这一部分我一般是在主函数里面做处理。因为框架不能保证所有的情况(及以后可能更新的情况)。目前我见到的情况有

  • 公众号迁移
  • 侵权被动删除
  • 主动删除
  • 违反规定被动删除
  • ......

from wechat_articles_spider.

mouwumou avatar mouwumou commented on May 21, 2024

首先感谢分享!
在运行代码的时候发现utils.py第189行timestamp2date(dt)报错,缺少一个格式化输入。阅读源码后认为这段代码可以删去,或者给定一个日期格式化,否则会在爬取第一轮(10次)的时候报错中断,删去这行代码后代码运行正常。
此外,给出的demo test_GetUrls.py中,84-88行中的url并没有定义(不过可能就是这样写防小白的?) 第27行item=line赋值可以删去,第24行改为 for i, line in enumerate(lst, 0): 同时,第56行需要判断flag是否为1,而这时会报错flag没有定义。应在前面定义flag函数,如在24行加入flag = 0
根据get_history_urls返回的数据格式,应在24行lst遍历前,加入一个遍历,如: def demo(lst_list): fj = "" item_lst = [] flag = 0 for lst in lst_list: for i, item in enumerate(lst, 0): 这样在demo中才能正确读取传入的数据,否则会报错。
还有源码53-54行的 finally: save_xlsx(fj, item_lst) 可以删去
感谢代码的分享,节省了很多造轮子的功夫。

  1. timestamp2date这个函数我确认了一下,应该是没问题的,不明白中断报错的点在哪里?方便可以把报错信息贴一下。
  2. 84-88行的链接没有贴出来的原因是,每个公众号的信息不一样。比如抓取A公众号的文章,贴的B公众号链接是不行的。见README中的联系注意事项,第三条
  3. demo这个函数在一开始就说明了仅供参考,出问题是因为,后续做了一些调整,没法保证时时都可用。如果您时间充裕,欢迎提交PR。
    # 抓取示例,供参考,不保证有效

在utils.py中定义的是timestamp2date(time_format_str, timestamp):(215行),而后面使用的时候传入了print(start_count, timestamp2date(dt))(189行)。这样(起码在我这里)会有一个缺少参数报错。在Url2Html.py中170行,也有timestamp2date的静态函数定义,这里就只定义了需要传入一个参数。

from wechat_articles_spider.

wnma3mz avatar wnma3mz commented on May 21, 2024

感谢提醒,这个函数上次提交刚做修改,没做更新。已修改。

def timestamp2date(timestamp, time_format_str="%Y-%m-%d"):

不过这个bug,我好像还没推送到pypi。。如果用pip安装的话,应该是不会有这个问题 :)

from wechat_articles_spider.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.