Skip to content

Instantly share code, notes, and snippets.

[
{
"_id": "58d5c70c27ea7d070060160e",
"categories": [
"55de81ac9d1fa51000f94770",
"55de81929d1fa51000f94769",
"55de81879d1fa51000f94766"
],
"coverImage": {
"_id": "58f318cc4909c907004ac575",
import requests
import json
import time
import numpy as np
import os
category = {
'55de818a9d1fa51000f94767': '生活',
'55de818d9d1fa51000f94768': '藝術',
'55de819a9d1fa51000f9476b': '運動',
[
{
"href": "/bbs/Beauty/M.1482072854.A.DDC.html",
"num_image": 3,
"push_count": 18,
"title": "[神人] 長榮空姐"
},
{
"href": "/bbs/Beauty/M.1482075654.A.C1D.html",
"num_image": 7,
import json
import math
from collections import Counter
from matplotlib import pyplot as plt
def mean(x):
return sum(x) / len(x)
import requests
import time
from bs4 import BeautifulSoup
import os
import re
import urllib.request
import json
PTT_URL = 'https://www.ptt.cc'
import requests
import time
from bs4 import BeautifulSoup
def get_web_page(url):
resp = requests.get(
url=url,
cookies={'over18': '1'}
)
from bs4 import BeautifulSoup
html_doc = """
<html>
<head>
<title>我是網頁標題</title>
<style>
.large {
color:blue;
text-align: center;
beautifulsoup4
cycler
matplotlib
numpy
pyparsing
python-dateutil
pytz
requests
six
import requests
def get_web_page(url):
resp = requests.get(
url=url,
cookies={'over18': '1'}
)
if resp.status_code != 200:
print('Invalid url:', resp.url)
import os, json
from bs4 import BeautifulSoup
import preprocess
if __name__ == '__main__':
current_dir = os.path.dirname(__file__)
form_dir = os.path.join(current_dir, 'forms')
input_dir = os.path.join(current_dir, 'corpus', 'all-input')
input_types = ['text', 'email', 'password']