Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
E
esi-table-data
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esi-data-scrapping
esi-table-data
Commits
f7f3419b
Commit
f7f3419b
authored
Jul 17, 2017
by
Vasyl Bodnaruk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change mixin to base spider class
parent
642b019e
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
10 deletions
+11
-10
__init__.py
exa/exa/helpers/__init__.py
+0
-1
aitop.py
exa/exa/spiders/aitop.py
+2
-2
base.py
exa/exa/spiders/base.py
+5
-3
mobihealthnews.py
exa/exa/spiders/mobihealthnews.py
+2
-2
techcrunch.py
exa/exa/spiders/techcrunch.py
+2
-2
No files found.
exa/exa/helpers/__init__.py
View file @
f7f3419b
from
.company_maker
import
CompanyMaker
from
.db
import
Database
from
.mixins
import
CommonMixin
exa/exa/spiders/aitop.py
View file @
f7f3419b
# -*- coding: utf-8 -*-
import
scrapy
import
dateparser
from
.
.helpers
import
CommonMixin
from
.
base
import
BaseSpider
from
..items
import
ExaItem
class
AitopSpider
(
CommonMixin
,
scrapy
.
Spider
):
class
AitopSpider
(
Base
Spider
):
name
=
"aitop"
allowed_domains
=
[
"aitopics.org"
]
...
...
exa/exa/
helpers/mixins
.py
→
exa/exa/
spiders/base
.py
View file @
f7f3419b
import
scrapy
from
scrapy.utils.project
import
get_project_settings
from
..helpers
import
CompanyMaker
,
Database
...
...
@@ -5,9 +6,10 @@ db_settings = get_project_settings().get('DB')
db
=
Database
(
**
db_settings
)
class
CommonMixin
:
def
__init__
(
self
,
*
args
,
**
kwargs
):
self
.
condition
=
kwargs
.
get
(
'query'
)
class
BaseSpider
(
scrapy
.
Spider
):
def
__init__
(
self
,
query
=
None
,
*
args
,
**
kwargs
):
super
(
BaseSpider
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
self
.
condition
=
query
self
.
query
=
"SELECT id, name, country FROM wp_esi_entity WHERE 1 and id=13"
if
self
.
condition
:
print
(
self
.
condition
)
...
...
exa/exa/spiders/mobihealthnews.py
View file @
f7f3419b
...
...
@@ -2,11 +2,11 @@
import
dateparser
import
scrapy
import
traceback
from
.
.helpers
import
CommonMixin
from
.
base
import
BaseSpider
from
..items
import
ExaItem
class
MobiHealthNewsSpider
(
CommonMixin
,
scrapy
.
Spider
):
class
MobiHealthNewsSpider
(
Base
Spider
):
name
=
"mhn"
allowed_domains
=
[
"www.mobihealthnews.com"
]
...
...
exa/exa/spiders/techcrunch.py
View file @
f7f3419b
# -*- coding: utf-8 -*-
import
scrapy
import
traceback
from
.
.helpers
import
CommonMixin
from
.
base
import
BaseSpider
from
..items
import
ExaItem
class
TechcrunchSpider
(
CommonMixin
,
scrapy
.
Spider
):
class
TechcrunchSpider
(
Base
Spider
):
name
=
"tc"
allowed_domains
=
[
"techcrunch.com"
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment