Compare commits
2 Commits
1e7ac17d90
...
ee27d7b679
Author | SHA1 | Date | |
---|---|---|---|
ee27d7b679 | |||
5610dc0f87 |
12
Dockerfile
12
Dockerfile
@ -1,16 +1,16 @@
|
|||||||
FROM python:3.8
|
FROM debian:11
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y git curl libcurl4-openssl-dev build-essential vim libssl-dev python-pip
|
RUN apt-get update && apt-get install -y git curl libcurl4-openssl-dev build-essential vim libssl-dev python2 python-dev wget python3 python3-pip
|
||||||
|
RUN wget https://bootstrap.pypa.io/pip/2.7/get-pip.py && python2 get-pip.py
|
||||||
RUN pip2 install cqlsh
|
RUN python2 -m pip install cqlsh
|
||||||
|
|
||||||
RUN addgroup appgroup && \
|
RUN addgroup appgroup && \
|
||||||
adduser appuser && adduser appuser appgroup
|
adduser appuser && adduser appuser appgroup
|
||||||
|
|
||||||
RUN mkdir /app /src
|
RUN mkdir /app /src
|
||||||
ADD requirements.txt /src/
|
ADD requirements.txt /src/
|
||||||
RUN CASS_DRIVER_BUILD_CONCURRENCY=4 pip install -r /src/requirements.txt
|
RUN CASS_DRIVER_BUILD_CONCURRENCY=4 pip3 install -r /src/requirements.txt
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
ADD . /src
|
ADD . /src
|
||||||
RUN python /src/setup.py install
|
RUN pip3 install /src/
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
1
build-docker.sh
Executable file
1
build-docker.sh
Executable file
@ -0,0 +1 @@
|
|||||||
|
docker build . -t dr.kemt.fei.tuke.sk/websucker:dev
|
@ -158,6 +158,13 @@ def check(ctx,domain):
|
|||||||
res = db.check_domain(domain)
|
res = db.check_domain(domain)
|
||||||
print(res)
|
print(res)
|
||||||
|
|
||||||
|
@cli.command(help="Export domain as JSON doc per line")
|
||||||
|
@click.pass_context
|
||||||
|
@click.argument("domain")
|
||||||
|
def tojson(ctx,domain):
|
||||||
|
db = create_database_from_context(ctx)
|
||||||
|
db.export_domain(domain)
|
||||||
|
|
||||||
@cli.command(help="Print daily report")
|
@cli.command(help="Print daily report")
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
def report(ctx):
|
def report(ctx):
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import cassandra
|
import cassandra
|
||||||
import cassandra.cluster
|
import cassandra.cluster
|
||||||
|
import cassandra.query
|
||||||
from cassandra.auth import PlainTextAuthProvider
|
from cassandra.auth import PlainTextAuthProvider
|
||||||
import random
|
import random
|
||||||
import os
|
import os
|
||||||
@ -8,6 +9,7 @@ import datetime
|
|||||||
from websucker.parser import normalize_link,urlunparse
|
from websucker.parser import normalize_link,urlunparse
|
||||||
import collections
|
import collections
|
||||||
import math
|
import math
|
||||||
|
import json
|
||||||
|
|
||||||
VERSION = "sucker6"
|
VERSION = "sucker6"
|
||||||
|
|
||||||
@ -543,6 +545,11 @@ INSERT INTO content(
|
|||||||
result.append((d,0))
|
result.append((d,0))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
def export_domain(self,domain):
|
||||||
|
rows = self.session.execute("SELECT JSON * from content WHERE domain_name=%s",(domain,))
|
||||||
|
for row in rows:
|
||||||
|
print(row[0])
|
||||||
|
|
||||||
def get_visit_links(self,domain,recent_count,old_count,random_count):
|
def get_visit_links(self,domain,recent_count,old_count,random_count):
|
||||||
dblinks = []
|
dblinks = []
|
||||||
rows = self.session.execute("SELECT url_schema,url_path,url_query,update_time FROM links Where domain_name=%s AND link_status='seen'",(domain,))
|
rows = self.session.execute("SELECT url_schema,url_path,url_query,update_time FROM links Where domain_name=%s AND link_status='seen'",(domain,))
|
||||||
|
Loading…
Reference in New Issue
Block a user