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
10fa7994
Commit
10fa7994
authored
Jul 10, 2017
by
Vasyl Bodnaruk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add function for extend item by common info
parent
80fff8c6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
aitop.py
exa/exa/spiders/aitop.py
+6
-1
No files found.
exa/exa/spiders/aitop.py
View file @
10fa7994
...
...
@@ -89,6 +89,7 @@ class AitopSpider(scrapy.Spider):
item
[
'title'
]
=
''
.
join
(
i
.
xpath
(
".//div[contains(@class, 'col-xs-12')]/h3/a//text()"
)
.
extract
())
item
[
'description'
]
=
''
.
join
(
i
.
xpath
(
".//div[@class='summary-content']/p/text()"
)
.
extract
())
item
[
'url'
]
=
i
.
xpath
(
".//div[contains(@class, 'col-xs-12')]/h3/a/@href"
)
.
extract_first
()
item
.
update
(
self
.
get_common_items
(
response
.
meta
[
'company'
]))
items
.
append
(
item
)
return
items
except
:
...
...
@@ -99,4 +100,8 @@ class AitopSpider(scrapy.Spider):
if
has_next
and
has_next
!=
'#'
:
return
'https://aitopics.org/search'
+
has_next
else
:
return
None
\ No newline at end of file
return
None
def
get_common_items
(
self
,
company
):
return
{
'region_id'
:
company
.
region_id
,
'type_id'
:
company
.
type_id
,
'media_id'
:
company
.
media_id
,
'company_id'
:
company
.
id
}
\ No newline at end of file
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