Browse Source

add crawler

master
= 4 years ago
parent
commit
e94f182ec1
8 changed files with 53 additions and 120 deletions
  1. +0
    -0
      .idea/.gitignore
  2. +0
    -4
      .idea/encodings.xml
  3. +12
    -0
      .idea/inspectionProfiles/Project_Default.xml
  4. +19
    -101
      .idea/workspace.xml
  5. +8
    -0
      APP/requirements.txt
  6. +1
    -1
      APP/server.py
  7. +13
    -13
      APP/view/block.py
  8. +0
    -1
      APP/view/database.py

+ 0
- 0
.idea/.gitignore View File


+ 0
- 4
.idea/encodings.xml View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
</project>

+ 12
- 0
.idea/inspectionProfiles/Project_Default.xml View File

@ -0,0 +1,12 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="ignoredErrors">
<list>
<option value="N801" />
</list>
</option>
</inspection_tool>
</profile>
</component>

+ 19
- 101
.idea/workspace.xml View File

@ -2,97 +2,26 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="ccd18ece-a4ed-4116-ada0-c6de56a9afb1" name="默认的" comment="">
<change beforePath="$PROJECT_DIR$/APP/templates/forget.html" beforeDir="false" afterPath="$PROJECT_DIR$/APP/templates/forget.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/APP/templates/register.html" beforeDir="false" afterPath="$PROJECT_DIR$/APP/templates/register.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/APP/view/auth.py" beforeDir="false" afterPath="$PROJECT_DIR$/APP/view/auth.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/.gitignore" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/encodings.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/APP/static/js/wsy.js" beforeDir="false" afterPath="$PROJECT_DIR$/APP/static/js/wsy.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/APP/templates/personal.html" beforeDir="false" afterPath="$PROJECT_DIR$/APP/templates/personal.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/APP/templates/square.html" beforeDir="false" afterPath="$PROJECT_DIR$/APP/templates/square.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/APP/view/block.py" beforeDir="false" afterPath="$PROJECT_DIR$/APP/view/block.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/APP/view/database.py" beforeDir="false" afterPath="$PROJECT_DIR$/APP/view/database.py" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileEditorManager">
<leaf>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/APP/server.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="57">
<caret line="3" column="38" lean-forward="true" selection-start-line="3" selection-start-column="38" selection-end-line="3" selection-end-column="38" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/APP/view/database.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="57">
<caret line="3" column="70" selection-start-line="3" selection-start-column="70" selection-end-line="3" selection-end-column="70" />
<folding>
<element signature="e#0#36#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/APP/view/auth.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="437">
<caret line="88" column="42" lean-forward="true" selection-start-line="88" selection-start-column="42" selection-end-line="88" selection-end-column="42" />
<folding>
<element signature="e#0#52#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/APP/templates/login.html">
<provider selected="true" editor-type-id="text-editor">
<state>
<caret line="23" selection-start-line="23" selection-end-line="23" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/APP/templates/register.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="252">
<caret line="28" column="17" lean-forward="true" selection-start-line="28" selection-start-column="17" selection-end-line="28" selection-end-column="17" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/APP/templates/forget.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="247">
<caret line="33" column="34" lean-forward="true" selection-start-line="33" selection-start-column="34" selection-end-line="33" selection-end-column="34" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/APP/view/block.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="38">
<caret line="2" column="11" selection-start-line="2" selection-start-column="11" selection-end-line="2" selection-end-column="11" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/APP/view/collection.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="19">
<caret line="1" column="26" selection-start-line="1" selection-start-column="26" selection-end-line="1" selection-end-column="26" />
</state>
</provider>
</entry>
</file>
</leaf>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Python Script" />
</list>
</option>
</component>
<component name="FindInProjectRecents">
<findStrings>
@ -101,6 +30,7 @@
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
<option name="RESET_MODE" value="HARD" />
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
@ -172,19 +102,7 @@
<component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/../../../dataManage/proj3/bookstore" />
</component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
</component>
<component name="RunManager">
<configuration default="true" type="PythonConfigurationType" factoryName="Python">
@ -215,8 +133,8 @@
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="C:\Users\dell\AppData\Local\Programs\Python\Python37-32\python.exe" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/APP" />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
@ -235,7 +153,7 @@
</list>
</recent_temporary>
</component>
<component name="SpellCheckerSettings" BundledDictionaries="0" Folders="0" CustomDictionaries="0" Dictionaries="0" CorrectionsLimit="5" DefaultDictionary="application-level" UseSingleDictionary="true" />
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="SvnConfiguration">
<configuration />
</component>

+ 8
- 0
APP/requirements.txt View File

@ -0,0 +1,8 @@
pymongo==3.11.0
requests==2.24.0
SQLAlchemy==1.3.22
Flask==1.1.2
Flask_Cors==3.0.9
APP==0.0.1
beautifulsoup4==4.9.3
Pillow==8.1.0

+ 1
- 1
APP/server.py View File

@ -20,5 +20,5 @@ app.register_blueprint(bp_auth)
app.register_blueprint(bp_start)
app.register_blueprint(bp_block)
app.register_blueprint(bp_collection)
#init_db()
init_db()
app.run(debug=True)

+ 13
- 13
APP/view/block.py View File

@ -3,9 +3,10 @@ from bson import json_util
import uuid
import os
import io
from PIL import Image
from APP.view.database import db_session
from APP.view.model import Block, CollectionBlock
import requests
from bs4 import BeautifulSoup
bp_block = Blueprint("block", __name__, url_prefix="/block")
@ -174,19 +175,18 @@ def edit():
def get_web_name():
url = request.form.get('url')
ret = {'msg': 'succuss'}
"""
html = requests.get(url)
html.encoding = 'utf-8'
soup = BeautifulSoup(html.text, "html.parser")
title = soup.find('title').text
"""
ret['name'] = url对应的网站的titleurl
"""
"""
return json_util.dumps(ret)
if title != None:
ret['name'] = title
else:
ret['name'] = url
@bp_block.route("/get_pic", methods=["POST"])
def get_pic():
img = bytes(request.form.get('pic'), encoding = "utf8")
return json_util.dumps(ret)
byte_stream = io.BytesIO(img)
im2 = Image.open(byte_stream)
ret = {'msg': 'succuss'}
im2.save(request.form.get('pic')[20:]+".gif", "GIF")
ret['url'] = request.form.get('pic')[20:]+".gif"
return ret

+ 0
- 1
APP/view/database.py View File

@ -16,4 +16,3 @@ def init_db():
Base.metadata.drop_all(bind=engine)
Base.metadata.create_all(bind=engine)
#init_db()

Loading…
Cancel
Save