ComicSpider | first open-source crawler | Crawler library
kandi X-RAY | ComicSpider Summary
kandi X-RAY | ComicSpider Summary
The first open-source crawler of raw comics images on dmzj website. 第一个开源的动漫之家漫画站电脑版原图爬虫.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Crawl crawl
- Download a single page
- Get pages from page
- Get info
- Preview comic
- Return a text representation of the comic
- Download chapter m
- Download a chapter
- Downloads chapters
- Converts a title to a string
- Download all chapters of the comic
- Setup the UI
- Translate the UI
- Update the comic list
- Download comic objects from a file
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
You can use ComicSpider like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
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