This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scrapy | |
class IthomeArticleItem(scrapy.Item): | |
_id = scrapy.Field() | |
url = scrapy.Field() | |
title = scrapy.Field() | |
author = scrapy.Field() | |
publish_time = scrapy.Field() | |
tags = scrapy.Field() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scrapy | |
from datetime import datetime | |
import re | |
import ithome_crawlers.items as items | |
class IthomeSpider(scrapy.Spider): | |
name = 'ithome' | |
allowed_domains = ['ithome.com.tw'] | |
def start_requests(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scrapy | |
from datetime import datetime | |
import re | |
class IthomeSpider(scrapy.Spider): | |
name = 'ithome' | |
allowed_domains = ['ithome.com.tw'] | |
def start_requests(self): | |
for page in range(1, 11): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup | |
from datetime import datetime | |
import re | |
from pymongo import MongoClient | |
host = 'localhost' | |
dbname = '<' | |
client = MongoClient(host, 27017) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup | |
from datetime import datetime | |
import re | |
import psycopg2 | |
host = "localhost" | |
user = "postgres" | |
dbname = "<your_database>" | |
password = "<server_admin_password>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup | |
from datetime import datetime | |
import re | |
import psycopg2 | |
host = "localhost" | |
user = "postgres" | |
dbname = "ithome2019" | |
password = "<server_admin_password>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup | |
from datetime import datetime | |
import re | |
import psycopg2 | |
host = 'localhost' | |
user = 'postgres' | |
dbname = 'ithome2019' | |
password = '<server_admin_password>' |