資通電0095T軍事訓練役--專題開發參考資料
1、Defining the actionBar
2、webView 錯誤net::ERR_CLEARTEXT_NOT_PERMITTED
自己是改用https就可以了
3、調用google翻譯
(未成功版本)
(成功版本)
4、解析網頁(爬蟲)
(未成功)
5、google translate API官網
https://cloud.google.com/translate/pricing#projects_charged
6、爬蟲測試(python--bs4)
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 15 08:41:13 2019
@author: iws01
"""
import requests
from bs4 import BeautifulSoup
# 下載網頁內容
r = requests.get('https://translate.google.com/m?hl=en&sl=zh-TW&tl=en&ie=UTF-8&prev=_m&q=%E4%BD%A0%E5%A5%BD')
# 確認是否下載成功
if r.status_code == requests.codes.ok:
# 以 BeautifulSoup 解析 HTML 程式碼
soup = BeautifulSoup(r.text, 'html.parser')
#print(soup.prettify())
t_string=soup.find('div',class_="t0")
print(t_string.text)
#print(title_tag.string)
"""
# 以 CSS 的 class 抓出各類頭條新聞
stories = soup.find_all('a', class_='story-title')
for s in stories:
# 新聞標題
print("標題:" + s.text)
# 新聞網址
print("網址:" + s.get('href'))
"""
7、爬蟲(jsoup)
https://aboullaite.me/jsoup-html-parser-tutorial-examples/
https://www.tutorialspoint.com/jsoup/jsoup_use_selector.htm
8、連線問題(Network Security Configuration、NetworkOnMainThreadException)
https://codelabs.developers.google.com/codelabs/android-network-security-config/#3
https://bibby1101.pixnet.net/blog/post/47753182-%E3%80%8Aandroid%E3%80%8Bandroid.os.networkonmainthreadexception-%E9%8C%AF%E8%AA%A4
6、爬蟲測試(python--bs4)
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 15 08:41:13 2019
@author: iws01
"""
import requests
from bs4 import BeautifulSoup
# 下載網頁內容
r = requests.get('https://translate.google.com/m?hl=en&sl=zh-TW&tl=en&ie=UTF-8&prev=_m&q=%E4%BD%A0%E5%A5%BD')
# 確認是否下載成功
if r.status_code == requests.codes.ok:
# 以 BeautifulSoup 解析 HTML 程式碼
soup = BeautifulSoup(r.text, 'html.parser')
#print(soup.prettify())
t_string=soup.find('div',class_="t0")
print(t_string.text)
#print(title_tag.string)
"""
# 以 CSS 的 class 抓出各類頭條新聞
stories = soup.find_all('a', class_='story-title')
for s in stories:
# 新聞標題
print("標題:" + s.text)
# 新聞網址
print("網址:" + s.get('href'))
"""
7、爬蟲(jsoup)
https://aboullaite.me/jsoup-html-parser-tutorial-examples/
https://www.tutorialspoint.com/jsoup/jsoup_use_selector.htm
8、連線問題(Network Security Configuration、NetworkOnMainThreadException)
https://codelabs.developers.google.com/codelabs/android-network-security-config/#3
https://bibby1101.pixnet.net/blog/post/47753182-%E3%80%8Aandroid%E3%80%8Bandroid.os.networkonmainthreadexception-%E9%8C%AF%E8%AA%A4