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
1d35b5b6
Commit
1d35b5b6
authored
Jul 24, 2017
by
Vasyl Bodnaruk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete debug message
parent
5d7b9c3f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
mobihealthnews.py
exa/exa/spiders/mobihealthnews.py
+0
-1
techcrunch.py
exa/exa/spiders/techcrunch.py
+9
-3
No files found.
exa/exa/spiders/mobihealthnews.py
View file @
1d35b5b6
...
...
@@ -44,7 +44,6 @@ class MobiHealthNewsSpider(BaseSpider):
"..//div[contains(@class, 'text-center')]/ul/li[contains(@class, 'next')]/a/@href"
)
.
extract_first
()
print
(
"COUNT"
,
is_duplicate
)
if
self
.
can_follow
(
has_next
,
is_duplicate
):
print
(
'yepta'
)
yield
scrapy
.
Request
(
next_url
,
callback
=
self
.
parse
,
meta
=
response
.
meta
)
else
:
print
(
"DUPLICATE NEWS"
)
...
...
exa/exa/spiders/techcrunch.py
View file @
1d35b5b6
...
...
@@ -53,6 +53,7 @@ class TechcrunchSpider(BaseSpider):
try
:
company
=
response
.
meta
[
'company'
]
news_list
=
response
.
xpath
(
".//div[contains(@class, 'block-content-topic')]"
)
is_duplicate
=
False
for
i
in
news_list
:
item
=
ExaItem
()
item
[
'date'
]
=
i
.
xpath
(
"./div/time/@datetime"
)
.
extract_first
()
...
...
@@ -64,14 +65,19 @@ class TechcrunchSpider(BaseSpider):
item
.
update
(
self
.
get_common_items
(
company
))
item
[
'post_id'
]
=
response
.
meta
[
'post_id'
]
if
self
.
pipeline
.
check_url
(
item
[
'url'
]):
is_duplicate
=
True
break
if
'Crunch Report'
not
in
item
[
'title'
]:
yield
scrapy
.
Request
(
item
[
'url'
],
callback
=
self
.
parse_tags
,
meta
=
{
'item'
:
item
})
has_next
=
response
.
xpath
(
"//div[contains(@class, 'river-nav')]//li[contains(@class, 'next')]/a/@href"
)
.
extract_first
()
if
has_next
:
yield
scrapy
.
Request
(
has_next
+
'/'
,
callback
=
self
.
parse_company
,
meta
=
response
.
meta
)
if
self
.
can_follow
(
has_next
,
is_duplicate
):
yield
scrapy
.
Request
(
has_next
+
'/'
,
callback
=
self
.
parse
,
meta
=
response
.
meta
)
else
:
print
(
"DUPLICATE NEWS"
)
except
BaseException
as
e
:
print
(
'We had error'
)
traceback
.
print_exc
()
...
...
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