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
c5d3c31d
Commit
c5d3c31d
authored
Jul 25, 2017
by
Vasyl Bodnaruk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Scrap freshness on parse_by_title_and_description
parent
ece88c78
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
aitop.py
exa/exa/spiders/aitop.py
+6
-3
base.py
exa/exa/spiders/base.py
+1
-1
No files found.
exa/exa/spiders/aitop.py
View file @
c5d3c31d
...
@@ -34,7 +34,7 @@ class AitopSpider(BaseSpider):
...
@@ -34,7 +34,7 @@ class AitopSpider(BaseSpider):
if
url_for_parse_tag
:
if
url_for_parse_tag
:
return
scrapy
.
Request
(
url_for_parse_tag
,
callback
=
self
.
parse_by_tag
,
meta
=
response
.
meta
)
return
scrapy
.
Request
(
url_for_parse_tag
,
callback
=
self
.
parse_by_tag
,
meta
=
response
.
meta
)
else
:
else
:
return
scrapy
.
Request
(
response
.
url
,
callback
=
self
.
parse_by_title_description
,
meta
=
response
.
meta
)
return
scrapy
.
Request
(
response
.
url
,
callback
=
self
.
parse_by_title_description
,
dont_filter
=
True
,
meta
=
response
.
meta
)
def
parse_by_title_description
(
self
,
response
):
def
parse_by_title_description
(
self
,
response
):
company
=
response
.
meta
[
'company'
]
company
=
response
.
meta
[
'company'
]
...
@@ -64,10 +64,13 @@ class AitopSpider(BaseSpider):
...
@@ -64,10 +64,13 @@ class AitopSpider(BaseSpider):
item
[
'tags'
]
=
i
.
xpath
(
item
[
'tags'
]
=
i
.
xpath
(
".//div[@class='row hidden-xs']//div[@title='Concept Tags']//a[@class='filter btn btn-link']/text()"
)
.
extract
()
".//div[@class='row hidden-xs']//div[@title='Concept Tags']//a[@class='filter btn btn-link']/text()"
)
.
extract
()
if
is_company_in_item
(
item
):
if
is_company_in_item
(
item
):
yield
i
if
self
.
pipeline
.
check_url
(
item
[
'url'
]):
is_duplicate
=
True
break
yield
item
next_url
=
self
.
next_url
(
response
)
next_url
=
self
.
next_url
(
response
)
if
next_url
:
if
self
.
can_follow
(
next_url
,
is_duplicate
)
:
yield
scrapy
.
Request
(
next_url
,
callback
=
self
.
parse_by_title_description
,
meta
=
response
.
meta
)
yield
scrapy
.
Request
(
next_url
,
callback
=
self
.
parse_by_title_description
,
meta
=
response
.
meta
)
else
:
else
:
print
(
"DUPLICATE NEWS"
)
print
(
"DUPLICATE NEWS"
)
...
...
exa/exa/spiders/base.py
View file @
c5d3c31d
...
@@ -10,7 +10,7 @@ class BaseSpider(scrapy.Spider):
...
@@ -10,7 +10,7 @@ class BaseSpider(scrapy.Spider):
def
__init__
(
self
,
query
=
None
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
query
=
None
,
*
args
,
**
kwargs
):
super
(
BaseSpider
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
super
(
BaseSpider
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
self
.
condition
=
query
self
.
condition
=
query
self
.
query
=
"SELECT id, name, country FROM wp_esi_entity WHERE 1 and id=1
3
"
self
.
query
=
"SELECT id, name, country FROM wp_esi_entity WHERE 1 and id=1
7
"
if
self
.
condition
:
if
self
.
condition
:
print
(
self
.
condition
)
print
(
self
.
condition
)
self
.
query
+=
' or {}'
.
format
(
self
.
condition
)
self
.
query
+=
' or {}'
.
format
(
self
.
condition
)
...
...
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