Example #1
0
status = 'harian'
database = 'scraper'
collection = 'tekno'
source = 'liputan6.com'
category = 'tekno'
name_category = 'tekno'
day = 31
month = 6
year = 2018

for i in range(31):

    #delete data from mongoDB
    db.delete_by_request(database, collection, source, i+1, month, year)

    # Get Data
    data = SL.get_dataHarian(category, name_category, year, month, i+1)

    attr = []
    for d in data:
        attr.append(d)

    db.insert_data(database, collection, attr)

    data = SL.get_ner2(database, collection, source, i+1, month, year)
    attr = []
    for d in data:
        attr.append(d)
    db.delete_by_request(database, collection, source, i+1, month, year)
    db.insert_data(database, collection, attr)
Example #2
0
#
# data = ST.get_ner()
# attr = []
# for d in data:
#     attr.append(d)
# db.delete_dataDaily('scraper', 'test', 'tempo.co')
# db.insert_data('scraper', 'test', attr)

###### LIPUTAN6 ########
#delete data from mongoDB
db.delete_dataDaily('scraper', 'test', 'liputan6.com')

list_category_liputan = ['tekno']
list_name_category_liputan = ['tekno']

# Get Data
for x, y in zip(list_category_liputan, list_name_category_liputan):
    data = SL.get_dataHarian(x, y, now.year, now.month, now.day)

    attr = []
    for i in range(len(data)):
        attr.append(data[i])

    db.insert_data('scraper', 'test', attr)

data = SL.get_ner()
attr = []
for d in data:
    attr.append(d)
db.delete_dataDaily('scraper', 'test', 'liputan6.com')
db.insert_data('scraper', 'test', attr)