ComicCrawler | An image crawler written in Python | Crawler library
kandi X-RAY | ComicCrawler Summary
kandi X-RAY | ComicCrawler Summary
An image crawler written in Python.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Bind event handler
- Add a mission by url
- Adds a task to analyze
- Convert text to underscores
- Creates a tk
- Creates the button
- Get the scaling factor
- Create the table
- Start download thread
- Gets a user media graph
- Get a module by url
- Create a safe safe table
- Gets the next page
- Start analysis thread
- Remove a pool from the pool
- Returns a list of Twitter Tweets
- Load session
- Save the current session
- Start the batch analyzer
- Load config file
- Check if the given page exists
- Return a list of episodes
- Create the body
- Check update for update
- Register event listeners
- Perform a HTTP request
ComicCrawler Key Features
ComicCrawler Examples and Code Snippets
Community Discussions
Trending Discussions on ComicCrawler
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 ComicCrawler
You can use ComicCrawler 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