def collect_drug_names(self, file_path, output_path):
        """Given list of drug names, collect urls for those review page on
            the scraper's website

        Args:
            file_path: input csv with list of drug names
            output_path: output csv with urls
        """
        if self.scraper == 'WebMD':
            scraper = WebMDScraper()
            scraper.get_drug_urls(file_path, output_path)
        elif self.scraper == 'EverydayHealth':
            scraper = EverydayHealthScraper()
            scraper.get_drug_urls(file_path, output_path)
        elif self.scraper == 'Drugs':
            scraper = DrugsScraper()
            scraper.get_drug_urls(file_path, output_path)
        elif self.scraper == 'DrugRatingz':
            scraper = DrugRatingzScraper()
            scraper.get_drug_urls(file_path, output_path)
Beispiel #2
0
def test_get_drug_urls_webmd():
    scraper = WebMDScraper()
    scraper.get_drug_urls('test-drug-names.csv', 'urls.csv')
    assert os.path.exists('urls.csv')
    os.remove('urls.csv')