Compare commits
	
		
			No commits in common. "master" and "feature/add-mirrativ" have entirely different histories.
		
	
	
		
			master
			...
			feature/ad
		
	
		
| @ -145,7 +145,7 @@ func (queue *Queue) Pop() (result interface{}, err error) { | |||||||
| 	rows, err := tx.Query(selectsql, queue.cond.CondArgs...) | 	rows, err := tx.Query(selectsql, queue.cond.CondArgs...) | ||||||
| 
 | 
 | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return nil, fmt.Errorf("table: %s queue is empty. %s", queue.table.name, err.Error()) | 		return nil, fmt.Errorf("table: %s queue is empty", queue.table.name) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	var fields = make([]interface{}, len(queue.fieldIndex)) | 	var fields = make([]interface{}, len(queue.fieldIndex)) | ||||||
|  | |||||||
| @ -1,159 +1 @@ | |||||||
| package main | package main | ||||||
| 
 |  | ||||||
| import ( |  | ||||||
| 	"database/sql" |  | ||||||
| 	"encoding/json" |  | ||||||
| 	"intimate" |  | ||||||
| 	"log" |  | ||||||
| 	"time" |  | ||||||
| 
 |  | ||||||
| 	"github.com/474420502/gcurl" |  | ||||||
| 	"github.com/tidwall/gjson" |  | ||||||
| ) |  | ||||||
| 
 |  | ||||||
| func main() { |  | ||||||
| 
 |  | ||||||
| 	sessionstr := ` |  | ||||||
| 	-H 'authority: www.mirrativ.com'  |  | ||||||
| 	-H 'accept: application/json'  |  | ||||||
| 	-H 'x-timezone: Asia/Shanghai'  |  | ||||||
| 	-H 'x-csrf-token: F3Ojd6RBtApP6YAZzVn-9jWN1of159VxAqOQL1Zn'  |  | ||||||
| 	-H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36'  |  | ||||||
| 	-H 'content-type: application/json'  |  | ||||||
| 	-H 'sec-fetch-site: same-origin'  |  | ||||||
| 	-H 'sec-fetch-mode: cors'  |  | ||||||
| 	-H 'sec-fetch-dest: empty'  |  | ||||||
| 	-H 'referer: https://www.mirrativ.com/live/O5Ia4iX9c5CeZj7DFtg52Q'  |  | ||||||
| 	-H 'accept-language: zh-CN,zh;q=0.9,ja;q=0.8'  |  | ||||||
| 	-H 'cookie: f=A2D75F0E-D218-11EA-A042-452BF6D21CE8; _ga=GA1.2.689947597.1596081392; mr_id=kxb65LddGMZf5C28jkR_tGCZD_ZFOAepD5gfXO7eNjfPMB8EKYvU1Vg_Y29V1lsa; _gid=GA1.2.2116692650.1600139685; lang=ja'` |  | ||||||
| 
 |  | ||||||
| 	ps := intimate.NewPerfectShutdown() |  | ||||||
| 	gprofile := gcurl.Parse(`curl 'https://www.mirrativ.com/api/user/profile?user_id=103383701'` + sessionstr) |  | ||||||
| 	tpProfile := gprofile.CreateTemporary(nil) |  | ||||||
| 	tpProfileUserID := tpProfile.QueryParam("user_id") |  | ||||||
| 
 |  | ||||||
| 	g := gcurl.Parse(`culr 'https://www.mirrativ.com/api/live/live?live_id=O5Ia4iX9c5CeZj7DFtg52Q'` + sessionstr) |  | ||||||
| 	tpLive := g.CreateTemporary(nil) |  | ||||||
| 	tpLiveID := tpLive.QueryParam("live_id") |  | ||||||
| 
 |  | ||||||
| 	var lasterr error |  | ||||||
| 	queue := intimate.TStreamer.Queue(intimate.Streamer{}, intimate.ConditionDefault(intimate.PMirrativ)) |  | ||||||
| 	for !ps.IsClose() { |  | ||||||
| 		istreamer, err := queue.Pop() |  | ||||||
| 		if err != nil { |  | ||||||
| 			if lasterr != err { |  | ||||||
| 				lasterr = err |  | ||||||
| 				log.Println(err) |  | ||||||
| 			} |  | ||||||
| 			ps.Wait(time.Second * 5) |  | ||||||
| 			continue |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		now := &sql.NullTime{Time: time.Now(), Valid: true} |  | ||||||
| 		streamer := istreamer.(*intimate.Streamer) |  | ||||||
| 		streamer.UpdateTime = now |  | ||||||
| 		userid := *streamer.UserId |  | ||||||
| 		log.Println(userid) |  | ||||||
| 
 |  | ||||||
| 		tpProfileUserID.StringSet(userid) |  | ||||||
| 		resp, err := tpProfile.Execute() |  | ||||||
| 		if err != nil { |  | ||||||
| 			log.Println(err) |  | ||||||
| 			time.Sleep(time.Second) |  | ||||||
| 			continue |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		clog := &intimate.CollectLog{} |  | ||||||
| 		clog.Platform = intimate.PMirrativ |  | ||||||
| 		clog.UpdateTime = now |  | ||||||
| 		clog.UserId = userid |  | ||||||
| 		clog.StreamerUid = streamer.Uid |  | ||||||
| 
 |  | ||||||
| 		profilejson := gjson.ParseBytes(resp.Content()) |  | ||||||
| 		if result := profilejson.Get("follower_num"); result.Exists() { |  | ||||||
| 			clog.Followers = &sql.NullInt64{Int64: result.Int(), Valid: true} |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		if result := profilejson.Get("onlive.live_id"); result.Exists() { |  | ||||||
| 			liveID := result.String() |  | ||||||
| 			tpLiveID.StringSet(liveID) |  | ||||||
| 			resp, err = tpLive.Execute() |  | ||||||
| 			if err != nil { |  | ||||||
| 				log.Println(err) |  | ||||||
| 				continue |  | ||||||
| 			} |  | ||||||
| 
 |  | ||||||
| 			livejson := gjson.ParseBytes(resp.Content()) |  | ||||||
| 			if result := livejson.Get("total_viewer_num"); result.Exists() { |  | ||||||
| 				clog.Views = &sql.NullInt64{Int64: result.Int(), Valid: true} |  | ||||||
| 			} |  | ||||||
| 
 |  | ||||||
| 			if result := livejson.Get("title"); result.Exists() { |  | ||||||
| 				clog.LiveTitle = &sql.NullString{String: result.String(), Valid: true} |  | ||||||
| 			} |  | ||||||
| 
 |  | ||||||
| 			if result := livejson.Get("started_at"); result.Exists() { |  | ||||||
| 				clog.LiveStartTime = &sql.NullTime{Time: time.Unix(result.Int(), 0), Valid: true} |  | ||||||
| 			} |  | ||||||
| 
 |  | ||||||
| 			if result := livejson.Get("heartbeated_at"); result.Exists() { |  | ||||||
| 				clog.LiveEndTime = &sql.NullTime{Time: time.Unix(result.Int(), 0), Valid: true} |  | ||||||
| 			} |  | ||||||
| 
 |  | ||||||
| 			if result := livejson.Get("app_id"); result.Exists() { |  | ||||||
| 				streamer.Channel = &sql.NullString{String: result.String(), Valid: true} |  | ||||||
| 			} |  | ||||||
| 
 |  | ||||||
| 			if result := livejson.Get("timeline.#.app.short_title"); result.Exists() { |  | ||||||
| 				for _, tl := range result.Array() { |  | ||||||
| 					var tags []string = []string{tl.String()} |  | ||||||
| 					jtags, _ := json.Marshal(tags) |  | ||||||
| 					streamer.Tags = jtags |  | ||||||
| 					clog.Tags = jtags |  | ||||||
| 					break |  | ||||||
| 				} |  | ||||||
| 			} else { |  | ||||||
| 				log.Println(string(resp.Content())) |  | ||||||
| 				return |  | ||||||
| 			} |  | ||||||
| 
 |  | ||||||
| 			if result := livejson.Get("gift_ranking_url"); result.Exists() { |  | ||||||
| 				// streamer.Channel = &sql.NullString{String: result.String(), Valid: true} |  | ||||||
| 				gifturl := "curl '" + result.String() + "&type=monthly&cursor='" + sessionstr |  | ||||||
| 				ggift := gcurl.Parse(gifturl) |  | ||||||
| 				tp := ggift.CreateTemporary(nil) |  | ||||||
| 				tp.SetURLRawPath("/api/gift/ranking") |  | ||||||
| 				pcursor := tp.QueryParam("cursor") |  | ||||||
| 				var gratuity int64 = 0 |  | ||||||
| 
 |  | ||||||
| 				for { |  | ||||||
| 					giftdata, err := tp.Execute() |  | ||||||
| 					giftjson := gjson.ParseBytes(giftdata.Content()) |  | ||||||
| 					if err != nil { |  | ||||||
| 						log.Println(err) |  | ||||||
| 					} else { |  | ||||||
| 						for _, rpoint := range giftjson.Get("ranking.#.point").Array() { |  | ||||||
| 							gratuity += rpoint.Int() |  | ||||||
| 						} |  | ||||||
| 					} |  | ||||||
| 					ncursor := giftjson.Get("next_cursor").String() |  | ||||||
| 					if ncursor == "" { |  | ||||||
| 						break |  | ||||||
| 					} |  | ||||||
| 					pcursor.StringSet(ncursor) |  | ||||||
| 				} |  | ||||||
| 				// https://www.mirrativ.com/gift/ranking?live_id=O5Ia4iX9c5CeZj7DFtg52Q&obfuscated_user_id=PgIBEgc6jVc |  | ||||||
| 				clog.Gratuity = &sql.NullInt64{Int64: gratuity, Valid: true} |  | ||||||
| 			} |  | ||||||
| 
 |  | ||||||
| 			cid, err := intimate.TClog.InsertRetAutoID(clog) |  | ||||||
| 			if err != nil { |  | ||||||
| 				log.Println(err) |  | ||||||
| 			} |  | ||||||
| 			streamer.LatestLogUid = cid |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		intimate.TStreamer.Update(streamer) |  | ||||||
| 		time.Sleep(time.Second * 2) |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
|  | |||||||
| @ -1,9 +1,51 @@ | |||||||
| package main | package main | ||||||
| 
 | 
 | ||||||
| import ( | import ( | ||||||
|  | 	"intimate" | ||||||
|  | 	"log" | ||||||
| 	"testing" | 	"testing" | ||||||
|  | 	"time" | ||||||
|  | 
 | ||||||
|  | 	"github.com/474420502/gcurl" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
|  | func main() { | ||||||
|  | 
 | ||||||
|  | 	ps := intimate.NewPerfectShutdown() | ||||||
|  | 	gprofile := gcurl.Parse(`https://www.mirrativ.com/api/user/profile?user_id=103383701`) | ||||||
|  | 	tpProfile := gprofile.CreateTemporary(nil) | ||||||
|  | 	tpProfileUserID := tpProfile.QueryParam("user_id") | ||||||
|  | 
 | ||||||
|  | 	g := gcurl.Parse(`https://www.mirrativ.com/api/live/live?live_id=O5Ia4iX9c5CeZj7DFtg52Q`) | ||||||
|  | 	tpLive := g.CreateTemporary(nil) | ||||||
|  | 	tpLiveID := tpLive.QueryParam("live_id") | ||||||
|  | 
 | ||||||
|  | 	queue := intimate.TStreamer.Queue(intimate.Streamer{}, intimate.ConditionDefault(intimate.PMirrativ)) | ||||||
|  | 	for !ps.IsClose() { | ||||||
|  | 		istreamer, err := queue.Pop() | ||||||
|  | 		if err != nil { | ||||||
|  | 			log.Println(err) | ||||||
|  | 			time.Sleep(time.Second * 2) | ||||||
|  | 			continue | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
|  | 		streamer := istreamer.(*intimate.Streamer) | ||||||
|  | 		userid := *streamer.UserId | ||||||
|  | 
 | ||||||
|  | 		tpProfileUserID.StringSet(userid) | ||||||
|  | 		resp, err := tpProfile.Execute() | ||||||
|  | 		if err != nil { | ||||||
|  | 			log.Println(err) | ||||||
|  | 			time.Sleep(time.Second) | ||||||
|  | 			continue | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
|  | 		profilejson := gcurl.Parse(string(resp.Content())) | ||||||
|  | 
 | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  | 
 | ||||||
| func TestDo(t *testing.T) { | func TestDo(t *testing.T) { | ||||||
| 	main() | 	main() | ||||||
| } | } | ||||||
|  | |||||||
| @ -46,7 +46,7 @@ type Streamer struct { | |||||||
| 	Channel  *sql.NullString `field:"channel"`   // | 	Channel  *sql.NullString `field:"channel"`   // | ||||||
| 	Tags     interface{}     `field:"tags"` | 	Tags     interface{}     `field:"tags"` | ||||||
| 	Ext      interface{}     `field:"ext"` // | 	Ext      interface{}     `field:"ext"` // | ||||||
| 	// Comments interface{}     `field:"comments"` | 	Comments interface{}     `field:"comments"` | ||||||
| 
 | 
 | ||||||
| 	IsUpdateStreamer bool // 更新上面的内容 | 	IsUpdateStreamer bool // 更新上面的内容 | ||||||
| 	IsUpdateUrl      bool | 	IsUpdateUrl      bool | ||||||
|  | |||||||
| @ -1,6 +1,6 @@ | |||||||
| CURPATH=`pwd` | CURPATH=`pwd` | ||||||
| BINPATH=$(dirname "$CURPATH")/bin | BINPATH=$(dirname "$CURPATH")/bin | ||||||
| find $BINPATH -type f -name 'log' -exec truncate -s 0 {} + | find $BINPATH -type f -name 'log' -exec rm {} + | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1,10 +0,0 @@ | |||||||
| [supervisord] |  | ||||||
| nodaemon=true |  | ||||||
| 
 |  | ||||||
| [program:mirrativ_extractor] |  | ||||||
| directory = MYPATH/bin/mirrativ_extractor/ |  | ||||||
| command= MYPATH/bin/mirrativ_extractor/mirrativ_extractor |  | ||||||
| autorestart=true |  | ||||||
| stderr_logfile=MYPATH/bin/mirrativ_extractor/log |  | ||||||
| stderr_logfile_maxbytes=0 |  | ||||||
| stopsignal=QUIT |  | ||||||
| @ -1,13 +0,0 @@ | |||||||
| [supervisord] |  | ||||||
| nodaemon=false |  | ||||||
| 
 |  | ||||||
| [program:mirrativ_task1] |  | ||||||
| environment=DISPLAY=":99" |  | ||||||
| directory = MYPATH/bin/mirrativ_task1/ |  | ||||||
| command= MYPATH/bin/mirrativ_task1/mirrativ_task1  |  | ||||||
| # process_name=%(program_name)s_%(process_num)02d              ;多进程名称 |  | ||||||
| # numprocs=1                                                   ;启动多个进程 |  | ||||||
| autorestart=true |  | ||||||
| stderr_logfile=MYPATH/bin/mirrativ_task1/log |  | ||||||
| stderr_logfile_maxbytes=0 |  | ||||||
| stopsignal=QUIT |  | ||||||
| @ -31,8 +31,7 @@ func main() { | |||||||
| 	cursor := tp.QueryParam(`cursor`) | 	cursor := tp.QueryParam(`cursor`) | ||||||
| 	cursor.StringSet("") | 	cursor.StringSet("") | ||||||
| 
 | 
 | ||||||
| 	ps := intimate.NewPerfectShutdown() | 	for { | ||||||
| 	for !ps.IsClose() { |  | ||||||
| 
 | 
 | ||||||
| 		log.Println(tp.ParsedURL.String()) | 		log.Println(tp.ParsedURL.String()) | ||||||
| 		resp, err := tp.Execute() | 		resp, err := tp.Execute() | ||||||
| @ -58,15 +57,14 @@ func main() { | |||||||
| 				streamer.Platform = intimate.PMirrativ | 				streamer.Platform = intimate.PMirrativ | ||||||
| 				streamer.Operator = 0 | 				streamer.Operator = 0 | ||||||
| 				streamer.UserId = &guserid.Str | 				streamer.UserId = &guserid.Str | ||||||
| 				streamer.UserName = &sql.NullString{String: owner.Get("name").String(), Valid: true} | 				streamer.UserName = &sql.NullString{String: liveinfo.Get("name").String(), Valid: true} | ||||||
| 				streamer.UpdateInterval = 600 | 				streamer.UpdateInterval = 60 | ||||||
| 				streamer.UpdateTime = intimate.GetUpdateTimeNow() | 				streamer.UpdateTime = intimate.GetUpdateTimeNow() | ||||||
| 
 | 
 | ||||||
| 				err = intimate.TStreamer.InsertOrUpdate( | 				err = intimate.TStreamer.InsertOrUpdate( | ||||||
| 					streamer, | 					streamer, | ||||||
| 					intimate.DUpdate{Field: "update_time"}, | 					intimate.DUpdate{Field: "update_time"}, | ||||||
| 				) | 				) | ||||||
| 
 |  | ||||||
| 				if err != nil { | 				if err != nil { | ||||||
| 					log.Println(err) | 					log.Println(err) | ||||||
| 					panic(err) | 					panic(err) | ||||||
| @ -74,9 +72,9 @@ func main() { | |||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 		if next == "" { | 		if next == "" { | ||||||
| 			ps.Wait(time.Minute * 10) | 			time.Sleep(time.Minute * 5) | ||||||
| 		} else { | 		} else { | ||||||
| 			ps.Wait(time.Second * 2) | 			time.Sleep(time.Second * 2) | ||||||
| 		} | 		} | ||||||
| 		cursor.StringSet(next) | 		cursor.StringSet(next) | ||||||
| 	} | 	} | ||||||
|  | |||||||
| @ -5,5 +5,5 @@ import ( | |||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| func TestMain(t *testing.T) { | func TestMain(t *testing.T) { | ||||||
| 	main() | 
 | ||||||
| } | } | ||||||
|  | |||||||
| @ -2361,205 +2361,4 @@ | |||||||
|     "collab_enabled": 1, |     "collab_enabled": 1, | ||||||
|     "image_url": "https://cdn.mirrativ.com/mirrorman-prod/image/thumbnail_image_url/9bfba1b91a486106882577717aab4ccb4113b200d07dfb7127b087e4e52d8869_m.jpeg?1600164645", |     "image_url": "https://cdn.mirrativ.com/mirrorman-prod/image/thumbnail_image_url/9bfba1b91a486106882577717aab4ccb4113b200d07dfb7127b087e4e52d8869_m.jpeg?1600164645", | ||||||
|     "orientation_v2": "6" |     "orientation_v2": "6" | ||||||
| } | } | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| { |  | ||||||
|     "obfuscated_user_id": "PgIBEgc6jVc", |  | ||||||
|     "current_user_rank": null, |  | ||||||
|     "ranking": [ |  | ||||||
|         { |  | ||||||
|             "point": 10, |  | ||||||
|             "user": { |  | ||||||
|                 "share_url": "https://www.mirrativ.com/user/105481237", |  | ||||||
|                 "profile_image_url": "https://cdn.mirrativ.com/mirrorman-prod/image/profile_image/2d16160a4158c99daf92f287313a7b4df7797b9f1e07ae0f8983df42fbecec97_m.jpeg?1600205857", |  | ||||||
|                 "name": "wwwww", |  | ||||||
|                 "description": "", |  | ||||||
|                 "properties": [], |  | ||||||
|                 "badges": [], |  | ||||||
|                 "is_continuous_streamer": 0, |  | ||||||
|                 "is_new": 0, |  | ||||||
|                 "user_id": "105481237", |  | ||||||
|                 "onlive": null |  | ||||||
|             } |  | ||||||
|         }, |  | ||||||
|         { |  | ||||||
|             "point": 1, |  | ||||||
|             "user": { |  | ||||||
|                 "share_url": "https://www.mirrativ.com/user/103544585", |  | ||||||
|                 "profile_image_url": "https://cdn.mirrativ.com/mirrorman-prod/image/profile_image/40cbd7501613cf08f45c56704b1a80796413d7ac0f9e06851d7a4ebe6f1fe7de_m.jpeg?1600217414", |  | ||||||
|                 "name": "ꗼ𝒓𝑦𝒖ꗼ", |  | ||||||
|                 "description": "俺のファンか仲良い人にしかギフトとかはあげません!まぁ俺にファンなんて居ないけど", |  | ||||||
|                 "properties": [], |  | ||||||
|                 "badges": [ |  | ||||||
|                     { |  | ||||||
|                         "image_url": "https://cdn.mirrativ.com/assets/img/continuous_streamer/ic_badge_master_holiday_L.en.png?v1", |  | ||||||
|                         "small_image_url": "https://cdn.mirrativ.com/assets/img/continuous_streamer/ic_badge_master_holiday_S.en.png?v1" |  | ||||||
|                     } |  | ||||||
|                 ], |  | ||||||
|                 "is_continuous_streamer": 1, |  | ||||||
|                 "is_new": 0, |  | ||||||
|                 "catalog_label_image_url": "https://cdn.mirrativ.com/assets/img/continuous_streamer/ic_status_master_holiday_en@3x.png?v5", |  | ||||||
|                 "user_id": "103544585", |  | ||||||
|                 "onlive": null |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|     ], |  | ||||||
|     "status": { |  | ||||||
|         "msg": "", |  | ||||||
|         "ok": 1, |  | ||||||
|         "error": "", |  | ||||||
|         "captcha_url": "", |  | ||||||
|         "error_code": 0, |  | ||||||
|         "message": "" |  | ||||||
|     }, |  | ||||||
|     "next_cursor": "", |  | ||||||
|     "current_cursor": "bW9udGhseToxMDYwNjk5MTY6MjY2NzA0NzMvMA" |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| { |  | ||||||
|     "streaming_url_hls": "http://hls-cdn22.mirrativ.com/liveedge/c4d32ce6edec9a37e7b20cff4b656a95714b5b9ee872964d9e435debe74a9518/playlist.m3u8", |  | ||||||
|     "is_gift_supported": 1, |  | ||||||
|     "live_id": "9LtbLw58uSrzig_NTxutIw", |  | ||||||
|     "is_mirrorable": 0, |  | ||||||
|     "description": "いつも拝聴ありがとうございます!\nクラッカーは配信が落ちてしまうので、禁止でお願い致しますm(_ _)m\n", |  | ||||||
|     "total_viewer_num": 1127, |  | ||||||
|     "thumbnail_image_url": "", |  | ||||||
|     "is_archive": 0, |  | ||||||
|     "is_singing_karaoke": 0, |  | ||||||
|     "title": "雑談しながらゲームする!", |  | ||||||
|     "max_online_viewer_num": 212, |  | ||||||
|     "created_at": 1600194426, |  | ||||||
|     "is_live": 1, |  | ||||||
|     "started_at": 1600242640, |  | ||||||
|     "blur_image_url": "https://cdn.mirrativ.com/mirrorman-prod/image/thumbnail_image_url/64c45462a6dc1113cf984a2bebac27d99cbb9b12c736ee3d104dd4c0c4e086db_m.jpeg?blur=80&1600244617", |  | ||||||
|     "preview_blur_image_url": "", |  | ||||||
|     "live_mos": null, |  | ||||||
|     "thumbnail_blur_image_url": "", |  | ||||||
|     "image_url_without_letterbox": "", |  | ||||||
|     "diamonds": 0, |  | ||||||
|     "joined_live_thumbnail_image_url": "https://cdn.mirrativ.com/mirrorman-prod/image/live_capture/64c45462a6dc1113cf984a2bebac27d99cbb9b12c736ee3d104dd4c0c4e086db_m.jpeg?1600244617", |  | ||||||
|     "template_comments": [], |  | ||||||
|     "tags": [], |  | ||||||
|     "broadcast_host": "online.mirrativ.com", |  | ||||||
|     "live_user_key": "", |  | ||||||
|     "bcsvr_key": "1abe77db:Cp3UZxJW", |  | ||||||
|     "heartbeated_at": 1600244742, |  | ||||||
|     "shares": { |  | ||||||
|         "twitter": { |  | ||||||
|             "maxlength": 84, |  | ||||||
|             "card": { |  | ||||||
|                 "site": "mirrativ.com", |  | ||||||
|                 "image_url": "https://cdn.mirrativ.com/mirrorman-prod/image/custom_thumbnail/64c45462a6dc1113cf984a2bebac27d99cbb9b12c736ee3d104dd4c0c4e086db_share.jpeg?1600244617", |  | ||||||
|                 "title": "雑談しながらゲームする!", |  | ||||||
|                 "description": "🐉そあこ💖爽鱗🐉" |  | ||||||
|             }, |  | ||||||
|             "text": "", |  | ||||||
|             "placeholder": "この配信についてひとこと!" |  | ||||||
|         }, |  | ||||||
|         "others": { |  | ||||||
|             "text": "雑談しながらゲームする! #プラエデ #ミラティブ #配信 | https://www.mirrativ.com/live/9LtbLw58uSrzig_NTxutIw" |  | ||||||
|         }, |  | ||||||
|         "title": "🐉そあこ💖爽鱗🐉さんの配信を友達にシェアしよう!", |  | ||||||
|         "description": "友達が見に来てくれると配信者さんに伝わるよ!" |  | ||||||
|     }, |  | ||||||
|     "is_private": 0, |  | ||||||
|     "collab_supported": 1, |  | ||||||
|     "sticker_enabled": 0, |  | ||||||
|     "collab_has_vacancy": 0, |  | ||||||
|     "streaming_key": "c4d32ce6edec9a37e7b20cff4b656a95714b5b9ee872964d9e435debe74a9518", |  | ||||||
|     "stamp_num": 0, |  | ||||||
|     "linked_live": { |  | ||||||
|         "owner_badge_image_url": "https://cdn.mirrativ.com/assets/img/continuous_streamer/ic_badge_super_holiday_S.ja.png?v6", |  | ||||||
|         "live_id": "-L6kxuJm_HgJN7aBY5JjYg", |  | ||||||
|         "owner_id": "100895240", |  | ||||||
|         "owner_image_url": "https://cdn.mirrativ.com/mirrorman-prod/image/profile_image/2a6dab73acec21af7d4d08f53f854e4c3a429d0ba73cd3c8f7618f90ff3c4f9b_m.jpeg?1600184061", |  | ||||||
|         "owner_name": "🦔NICO*🦥🥈感謝" |  | ||||||
|     }, |  | ||||||
|     "collab_online_user_num": 0, |  | ||||||
|     "share_image_url": "https://cdn.mirrativ.com/mirrorman-prod/image/custom_thumbnail/64c45462a6dc1113cf984a2bebac27d99cbb9b12c736ee3d104dd4c0c4e086db_share.jpeg?1600244617", |  | ||||||
|     "broadcast_key": "1abe77db:Cp3UZxJW", |  | ||||||
|     "gift_ranking_url": "https://www.mirrativ.com/gift/ranking?live_id=9LtbLw58uSrzig_NTxutIw&obfuscated_user_id=PgIBEgc6jVc", |  | ||||||
|     "collab_mos": null, |  | ||||||
|     "archive_url_hls": "", |  | ||||||
|     "remaining_coins": 0, |  | ||||||
|     "ended_at": 0, |  | ||||||
|     "sticker_category_ids": [], |  | ||||||
|     "online_user_num": 174, |  | ||||||
|     "announcement_url": "", |  | ||||||
|     "anniversary_bot_comment": "", |  | ||||||
|     "is_emomo_wipe_enabled": 0, |  | ||||||
|     "share_url": "https://www.mirrativ.com/live/9LtbLw58uSrzig_NTxutIw", |  | ||||||
|     "status": { |  | ||||||
|         "msg": "", |  | ||||||
|         "ok": 1, |  | ||||||
|         "error": "", |  | ||||||
|         "captcha_url": "", |  | ||||||
|         "error_code": 0, |  | ||||||
|         "message": "" |  | ||||||
|     }, |  | ||||||
|     "orientation": 2, |  | ||||||
|     "app_id": "jp.co.yoozoo.projectyellow", |  | ||||||
|     "app_icon_urls": [ |  | ||||||
|         "https://cdn.mirrativ.com/mirrorman-prod/image/app_icon/999ce961e79bfe6d7fff3db363375a17a112810791a692b8858970efa599ca99.png" |  | ||||||
|     ], |  | ||||||
|     "timeline": [ |  | ||||||
|         { |  | ||||||
|             "app": { |  | ||||||
|                 "is_my_app": 0, |  | ||||||
|                 "icon_url": "https://cdn.mirrativ.com/mirrorman-prod/image/app_icon/999ce961e79bfe6d7fff3db363375a17a112810791a692b8858970efa599ca99.png", |  | ||||||
|                 "store_url": "https://go.onelink.me/app/c8e9133", |  | ||||||
|                 "app_id": "jp.co.yoozoo.projectyellow", |  | ||||||
|                 "short_title": "プラエデ", |  | ||||||
|                 "is_category": 0, |  | ||||||
|                 "title": "レッド:プライドオブエデン", |  | ||||||
|                 "id": 3139 |  | ||||||
|             }, |  | ||||||
|             "timestamp": 1600242607, |  | ||||||
|             "title": "雑談しながらゲームする!" |  | ||||||
|         } |  | ||||||
|     ], |  | ||||||
|     "enable_clap": 0, |  | ||||||
|     "is_paid_sticker_supported": 0, |  | ||||||
|     "announcement_urls": {}, |  | ||||||
|     "sticker_num": 0, |  | ||||||
|     "max_collab_user_num": 3, |  | ||||||
|     "comment_num": 145, |  | ||||||
|     "owner": { |  | ||||||
|         "share_url": "https://www.mirrativ.com/user/104326294", |  | ||||||
|         "is_able_continuous_stream_holiday": 1, |  | ||||||
|         "profile_image_url": "https://cdn.mirrativ.com/mirrorman-prod/image/profile_image/1046538382ddfccff9b118699ec605cb33cc3c61feb94122f79d5812221e99b5_m.jpeg?1600194531", |  | ||||||
|         "birthday_from": 1615561200, |  | ||||||
|         "is_birthday_editable": 1, |  | ||||||
|         "badges": [ |  | ||||||
|             { |  | ||||||
|                 "image_url": "https://cdn.mirrativ.com/assets/img/continuous_streamer/ic_badge_super_holiday_L.ja.png?v6", |  | ||||||
|                 "small_image_url": "https://cdn.mirrativ.com/assets/img/continuous_streamer/ic_badge_super_holiday_S.ja.png?v6" |  | ||||||
|             } |  | ||||||
|         ], |  | ||||||
|         "is_new": 0, |  | ||||||
|         "catalog_label_image_url": "https://cdn.mirrativ.com/assets/img/continuous_streamer/ic_status_super_holiday_ja@3x.png?v5", |  | ||||||
|         "birthday": "0314", |  | ||||||
|         "birthday_to": 1615820399, |  | ||||||
|         "name": "🐉そあこ💖爽鱗🐉", |  | ||||||
|         "is_birthday": 0, |  | ||||||
|         "description": "色んなゲームを17:30に定期配信してます♡ギフト当たった人は欲しい時にDM求む", |  | ||||||
|         "birthday_editable_date": "", |  | ||||||
|         "properties": [], |  | ||||||
|         "is_continuous_streamer": 1, |  | ||||||
|         "user_id": "104326294", |  | ||||||
|         "live_request_num": "70", |  | ||||||
|         "onlive": null |  | ||||||
|     }, |  | ||||||
|     "broadcast_port": 1883, |  | ||||||
|     "recommend_sticker_ids": [], |  | ||||||
|     "sticker_display_type": 0, |  | ||||||
|     "archive_comment_enabled": 0, |  | ||||||
|     "streaming_url_edge": "rtmp://edge-210-140-191-149.mirrativ.com:1935/liveedge/c4d32ce6edec9a37e7b20cff4b656a95714b5b9ee872964d9e435debe74a9518", |  | ||||||
|     "collab_enabled": 0, |  | ||||||
|     "image_url": "https://cdn.mirrativ.com/mirrorman-prod/image/thumbnail_image_url/64c45462a6dc1113cf984a2bebac27d99cbb9b12c736ee3d104dd4c0c4e086db_m.jpeg?1600244617", |  | ||||||
|     "orientation_v2": "6" |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // curl 'https://www.mirrativ.com/api/gift/ranking?obfuscated_user_id=PgIBEgc6jVc&live_id=O5Ia4iX9c5CeZj7DFtg52Q&type=monthly&cursor=' \ |  | ||||||
|    |  | ||||||
							
								
								
									
										24
									
								
								utils.go
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								utils.go
									
									
									
									
									
								
							| @ -110,13 +110,16 @@ func (adriver *AutoCloseDriver) Close() { | |||||||
| 	// log.Println(string(data)) | 	// log.Println(string(data)) | ||||||
| 
 | 
 | ||||||
| 	killshell := fmt.Sprintf("pkill -9 -P %s", data) | 	killshell := fmt.Sprintf("pkill -9 -P %s", data) | ||||||
|  | 	// log.Println(killshell) | ||||||
|  | 	// pkill -f \"port=%d\" | ||||||
|  | 	// log.Printf(fmt.Sprintf("kill -9 $(lsof -t -i:%d)", port)) | ||||||
| 	err = exec.Command("/bin/bash", "-c", killshell).Run() | 	err = exec.Command("/bin/bash", "-c", killshell).Run() | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		log.Println(err) | 		log.Println(err) | ||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	err = exec.Command("/bin/bash", "-c", fmt.Sprintf("kill -9 %s", data)).Run() | 	err = exec.Command("/bin/bash", "-c", fmt.Sprintf("kill %s", data)).Run() | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		log.Println(err) | 		log.Println(err) | ||||||
| 		return | 		return | ||||||
| @ -131,6 +134,8 @@ func GetChromeDriver() *AutoCloseDriver { | |||||||
| 	caps := selenium.Capabilities{"browserName": "chrome"} | 	caps := selenium.Capabilities{"browserName": "chrome"} | ||||||
| 
 | 
 | ||||||
| 	chromecaps := chrome.Capabilities{} | 	chromecaps := chrome.Capabilities{} | ||||||
|  | 
 | ||||||
|  | 	// chromecaps.AddExtension("/home/eson/test/myblock.crx") | ||||||
| 	for _, epath := range []string{"../../../crx/myblock.crx", "../../crx/myblock.crx"} { | 	for _, epath := range []string{"../../../crx/myblock.crx", "../../crx/myblock.crx"} { | ||||||
| 		_, err := os.Stat(epath) | 		_, err := os.Stat(epath) | ||||||
| 		if err == nil { | 		if err == nil { | ||||||
| @ -177,6 +182,23 @@ func GetChromeDriver() *AutoCloseDriver { | |||||||
| 	adriver.Port = port | 	adriver.Port = port | ||||||
| 	adriver.Webdriver = wd | 	adriver.Webdriver = wd | ||||||
| 
 | 
 | ||||||
|  | 	// runtime.SetFinalizer(adriver, func(obj interface{}) { | ||||||
|  | 
 | ||||||
|  | 	// 	adriver := obj.(*AutoCloseDriver) | ||||||
|  | 	// 	adriver.Webdriver.Close() | ||||||
|  | 	// 	adriver.Webdriver.Quit() | ||||||
|  | 
 | ||||||
|  | 	// 	killshell := fmt.Sprintf("pkill -P `pgrep -f 'port=%d '` && pkill -f 'port=%d '", port, port) | ||||||
|  | 	// 	log.Println(killshell) | ||||||
|  | 
 | ||||||
|  | 	// 	// log.Printf(fmt.Sprintf("kill -9 $(lsof -t -i:%d)", port)) | ||||||
|  | 	// 	// cmd := exec.Command("sh", "-c", killshell) | ||||||
|  | 	// 	// err = cmd.Run() | ||||||
|  | 	// 	// if err != nil { | ||||||
|  | 	// 	// 	log.Println(err) | ||||||
|  | 	// 	// } | ||||||
|  | 	// }) | ||||||
|  | 
 | ||||||
| 	wd.ExecuteScript("windows.navigator.webdriver = undefined", nil) | 	wd.ExecuteScript("windows.navigator.webdriver = undefined", nil) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		panic(err) | 		panic(err) | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user