This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import selenium | |
from selenium import webdriver | |
from bs4 import BeautifulSoup | |
import time as tm | |
import pandas as pd | |
from random import randint | |
#設定webdriver的參數,這個prefs是關掉Facebook通知 | |
chrome_options = webdriver.ChromeOptions() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function onOpen() { | |
// onOpen是讓Spreadsheet開啟時就要採取這個動作的函式 | |
var sheet = SpreadsheetApp.getActiveSpreadsheet(); | |
var menu = [ | |
{name : "寄出pdf", functionName : "send"}, | |
{name: "重新取得前三流量來源", functionName: "getPv"}, | |
]; | |
sheet.addMenu("特別功能", menu); // 新增一個叫做「特別功能」的下拉選單,裡面有寄出與取得來源兩個功能 | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<title><?=datam[1]?> | 中央社 CNA NEWS</title> | |
... | |
<meta property="og:image" content="http://www.cna.com.tw/project/cards/<?=datam[0]?><?=datam[3]?>" /> | |
<meta property="og:title" content="<?=datam[1]?> | 中央社" /> | |
<meta property="og:url" content="http://www.cna.com.tw/project/cards/<?=datam[0]?>/index.html"/> | |
... | |
<div class="row headerRow" style="background-color:<?=datac[0]?>; color:<?=datac[2]?>;"> | |
... | |
<h1 style="color:<?=datac[1]?>"><?=datam[1]?></h1> | |
<p><?datam[2]?></p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function doGet() { | |
// 使用htmlservice的從檔案製作模板,把模板叫做t | |
var t = HtmlService.createTemplateFromFile('index.html'); | |
// 取得編輯填寫內容的Spreadsheet位置 | |
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("卡片式特企模板"); | |
// head顏色處理 | |
var headerbg = sheet.getRange("B3").getBackground(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function onOpen() { | |
var sheet = SpreadsheetApp.getActiveSpreadsheet(); | |
var menu = [ | |
{name: "取得pv", functionName: "getPv"}, | |
]; | |
sheet.addMenu("特製功能", menu); | |
}; | |
// 在spreadsheet的功能列新增一個名為「特製功能」的下拉項目,裡面有一個「取得pv」的觸發按鈕 | |
function getPv() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function bitly(source,date,content,who,url) { | |
var d= (new Date(date.getTime()+3600000*24)).toISOString().slice(0,10).replace(/20/, "").replace("-","").replace("-",""); | |
//宣告一個變數叫d,取輸入的日期來清整格式 | |
var utm2= content.substring(0, 10)+'-'; | |
//避免網址太長或者是遇到特殊字被截斷,活動名稱只取10個字 | |
if (who.match("A|B")){ | |
var utm3= 'marketing-'+utm2; |