Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

指定parser_name和callback不生效 #242

Open
s2485523800 opened this issue Dec 16, 2023 · 0 comments
Open

指定parser_name和callback不生效 #242

s2485523800 opened this issue Dec 16, 2023 · 0 comments

Comments

@s2485523800
Copy link

feapder 1.8.9
问题
需求是对不同的网址采用不同的解析方式,但指定了parser_name和callback无效,相应位置打断点也不会进
截图
目录结构
image

代码
第一种尝试

 if 'weixin.qq.com' in i.xpath('./div[1]/a/@href')[0]:
                        yield feapder.Request(url=i.xpath('./div[1]/a/@href')[0],
                                              parser_name='WechatOfficialAccount',
                                               name='CompanyDynamics',
                                              time_l=i.xpath('./div[2]/div[2]/span/text()')[0],download_midware=self.download_midware)

第二种尝试(引入类)

 if 'weixin.qq.com' in i.xpath('./div[1]/a/@href')[0]:
                        yield feapder.Request(url=i.xpath('./div[1]/a/@href')[0],
                                              parser_name=WechatOfficialAccount,
                                               name='CompanyDynamics',
                                              time_l=i.xpath('./div[2]/div[2]/span/text()')[0],download_midware=self.download_midware)

第三种尝试

 if 'weixin.qq.com' in i.xpath('./div[1]/a/@href')[0]:
                        yield feapder.Request(url=i.xpath('./div[1]/a/@href')[0],
                                              parser_name=WechatOfficialAccount,
                                              callback='parse',
                                               name='CompanyDynamics',
                                              time_l=i.xpath('./div[2]/div[2]/span/text()')[0],download_midware=self.download_midware)

第四种尝试

 if 'weixin.qq.com' in i.xpath('./div[1]/a/@href')[0]:
                        yield feapder.Request(url=i.xpath('./div[1]/a/@href')[0],
                                              parser_name=WechatOfficialAccount,
                                              callback=WechatOfficialAccount.parse,
                                               name='CompanyDynamics',
                                              time_l=i.xpath('./div[2]/div[2]/span/text()')[0],download_midware=self.download_midware)

应该怎么写呢,貌似文档缺一个详细例子

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant