Skip to content

Commit

Permalink
Merge 58dfd50 into f80fbe1
Browse files Browse the repository at this point in the history
  • Loading branch information
nativaldezt authored Dec 9, 2020
2 parents f80fbe1 + 58dfd50 commit 7052c01
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/spiders.rst
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,13 @@ Moldova
scrapy crawl moldova_old
.. autoclass:: kingfisher_scrapy.spiders.moldova_positive_initiative.MoldovaPositiveInitiative
:no-members:

.. code-block:: bash
scrapy crawl moldova_positive_initiative
Nepal
-----

Expand Down
26 changes: 26 additions & 0 deletions kingfisher_scrapy/spiders/moldova_positive_initiative.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import scrapy
from kingfisher_scrapy.base_spider import SimpleSpider
from kingfisher_scrapy.util import components, get_parameter_value, handle_http_error


class MoldovaPositiveInitiative(SimpleSpider):
"""
Domain
Positive Initiative - Moldova
Bulk download documentation
https://www.tender.health/ocdsrelease
"""
name = 'moldova_positive_initiative'
data_type = 'release_package'

def start_requests(self):
url = 'https://www.tender.health/ocdsrelease'
yield scrapy.Request(url, meta={'file_name': 'page.html'}, callback=self.scrape_page)

@handle_http_error
def scrape_page(self, response, **kwargs):
hrefs = response.xpath('//a/@href').getall()
for href in hrefs:
if '.json' in href:
url = get_parameter_value(href, 'q')
yield self.build_request(url, formatter=components(-1))

0 comments on commit 7052c01

Please sign in to comment.