ComicSpider | Web comic downloader and viewer | Download Utils library
kandi X-RAY | ComicSpider Summary
kandi X-RAY | ComicSpider Summary
Web comic downloader and viewer.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ComicSpider
ComicSpider Key Features
ComicSpider Examples and Code Snippets
Community Discussions
Trending Discussions on ComicSpider
QUESTION
I'm using Scrapy to crawl a set of similar pages (webcomics). Because these pages are very similar, I wrote a class called ComicCrawler
which contains all the spider logic and some class variables (start_url
, next_selector
, etc.). I then override these class variables in concrete classes for each spider.
Manually creating classes for each comic is cumbersome. I now want to specify the attributes in a JSON file and create the classes during runtime (ie. apply the factory pattern (?)) How do I best go about that?
Alternatively: Is there a way to run a spider without creating a class for it? Edit: The core problem seems to be that Scrapy uses classes, not instances for its spiders. Otherwise I'd just make the class variables instance variables and be done with it.
Example:
...ANSWER
Answered 2019-Mar-12 at 21:36Look up metaclasses. This is the way in Python to dynamically create new classes. What are metaclasses in Python?
For this simpler case there is a simpler method which is described in chepner's answer.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ComicSpider
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page