From 617ed89bfea7eba903dc08be0873f0bc8a7be58b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=85=89=E6=98=A5?= Date: Tue, 24 May 2022 23:35:51 +0800 Subject: [PATCH] - init --- .drone.yml | 17 + .gitignore | 10 + api.go | 1090 ++++++++++++++++++++++++++++++++++++++++++++++++++++ go.mod | 26 ++ go.sum | 241 ++++++++++++ pgsql.go | 26 ++ version.go | 3 + weishi.go | 89 +++++ 8 files changed, 1502 insertions(+) create mode 100644 .drone.yml create mode 100644 .gitignore create mode 100644 api.go create mode 100644 go.mod create mode 100644 go.sum create mode 100644 pgsql.go create mode 100644 version.go create mode 100644 weishi.go diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..c56c479 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,17 @@ +kind: pipeline +type: docker +name: clone + +steps: + - name: Test + image: golang:1.18 + commands: + - go env -w GO111MODULE=on + - go env -w GOPROXY=https://goproxy.cn,direct + - go test -v ./... + - name: Benchmark + image: golang:1.18 + commands: + - go env -w GO111MODULE=on + - go env -w GOPROXY=https://goproxy.cn,direct + - go test -bench=. -benchmem \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..502d67a --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +.env +.git +.svn +.idea +.vscode +*.log +goinit.sh +gomod.sh +/vendor/ +*_test.go \ No newline at end of file diff --git a/api.go b/api.go new file mode 100644 index 0000000..315e697 --- /dev/null +++ b/api.go @@ -0,0 +1,1090 @@ +package weishi + +import ( + "encoding/json" + "errors" + "github.com/mvdan/xurls" + "go.dtapp.net/gorequest" + "regexp" + "strings" +) + +type AnalysisResponse struct { + Ret int `json:"ret"` + Msg string `json:"msg"` + Data struct { + Feeds []struct { + Id string `json:"id"` + Wording string `json:"wording"` + Type int `json:"type"` + PosterId string `json:"poster_id"` + Poster struct { + Id string `json:"id"` + Type int `json:"type"` + Uid string `json:"uid"` + Createtime int `json:"createtime"` + Nick string `json:"nick"` + Avatar string `json:"avatar"` + Sex int `json:"sex"` + FeedlistTimeId string `json:"feedlist_time_id"` + FeedlistHotId string `json:"feedlist_hot_id"` + RelatedFeedlistId string `json:"related_feedlist_id"` + FollowerlistId string `json:"followerlist_id"` + InteresterlistId string `json:"interesterlist_id"` + ChatlistId string `json:"chatlist_id"` + RichFlag int `json:"rich_flag"` + Age int `json:"age"` + Address string `json:"address"` + Wealth struct { + FlowerNum int `json:"flower_num"` + Score int `json:"score"` + } `json:"wealth"` + Background string `json:"background"` + Status string `json:"status"` + FollowStatus int `json:"followStatus"` + ChartScore int `json:"chartScore"` + ChartRank int `json:"chartRank"` + FeedGoldNum int `json:"feedGoldNum"` + AvatarUpdatetime int `json:"avatar_updatetime"` + DescFromOperator string `json:"desc_from_operator"` + SyncContent int `json:"sync_content"` + FeedlistPraiseId string `json:"feedlist_praise_id"` + Settingmask int `json:"settingmask"` + Originalavatar string `json:"originalavatar"` + BlockTime string `json:"block_time"` + Grade int `json:"grade"` + Medal int `json:"medal"` + BlockReason string `json:"block_reason"` + Qq int `json:"qq"` + RecommendReason string `json:"recommendReason"` + LastUpdateFeedNum int `json:"lastUpdateFeedNum"` + Updateinfo struct { + Flag int `json:"flag"` + Tip string `json:"tip"` + Num int `json:"num"` + } `json:"updateinfo"` + NickUpdatetime int64 `json:"nick_updatetime"` + LastDownloadAvatar string `json:"lastDownloadAvatar"` + RealName string `json:"realName"` + PinyinFirst string `json:"pinyin_first"` + CertifDesc string `json:"certif_desc"` + PrivateInfo struct { + PhoneNum string `json:"phone_num"` + Name string `json:"name"` + IdNum string `json:"id_num"` + } `json:"privateInfo"` + ExternInfo struct { + MpEx struct { + DarenPriority string `json:"daren_priority"` + LoginResaveOldAvatar string `json:"loginResaveOldAvatar"` + LoginResaveNewAvatar string `json:"loginResaveNewAvatar"` + LoginResaveTime string `json:"loginResaveTime"` + DarenCompany string `json:"daren_company"` + AuditPriority string `json:"audit_priority"` + SubPriority string `json:"sub_priority"` + } `json:"mpEx"` + BindAcct []interface{} `json:"bind_acct"` + BgPicUrl string `json:"bgPicUrl"` + LevelInfo struct { + Level int `json:"level"` + Score int `json:"score"` + PrevUpgradeTime int `json:"prev_upgrade_time"` + } `json:"level_info"` + WeishiId string `json:"weishiId"` + WeishiidModifyCount string `json:"weishiid_modify_count"` + WatermarkType int `json:"watermark_type"` + RealNick string `json:"real_nick"` + CmtLevel struct { + Level int `json:"level"` + Cmtscore int `json:"cmtscore"` + Dingscore int `json:"dingscore"` + PrevUpgradeTime int `json:"prev_upgrade_time"` + } `json:"cmt_level"` + FlexibilityFlag int `json:"flexibility_flag"` + LiveStatus int `json:"live_status"` + NowLiveRoomId int `json:"now_live_room_id"` + MedalInfo struct { + TotalScore int `json:"total_score"` + MedalList []interface{} `json:"medal_list"` + } `json:"medal_info"` + H5HasLogin int `json:"h5_has_login"` + } `json:"extern_info"` + CertifData struct { + CertifIcon string `json:"certif_icon"` + CertifJumpurl string `json:"certif_jumpurl"` + } `json:"certifData"` + IsShowPOI int `json:"isShowPOI"` + IsShowGender int `json:"isShowGender"` + FormatAddr struct { + Country string `json:"country"` + Province string `json:"province"` + City string `json:"city"` + } `json:"formatAddr"` + AuthorizeTime int `json:"authorize_time"` + ActivityInfo struct { + InvitePersonid string `json:"invitePersonid"` + } `json:"activityInfo"` + } `json:"poster"` + Video struct { + FileId string `json:"file_id"` + FileSize int `json:"file_size"` + Sha1 string `json:"sha1"` + PlayIndex int `json:"play_index"` + Duration int `json:"duration"` + Width int `json:"width"` + Height int `json:"height"` + Md5 string `json:"md5"` + Orientation int `json:"orientation"` + H265Hvc1 int `json:"h265_hvc1"` + MaxDb int `json:"max_db"` + VoiceRatio int `json:"voice_ratio"` + Loudnorm string `json:"loudnorm"` + MetaLoudnorm struct { + InputI string `json:"input_i"` + InputTp string `json:"input_tp"` + InputLra string `json:"input_lra"` + InputThresh string `json:"input_thresh"` + OutputI string `json:"output_i"` + OutputTp string `json:"output_tp"` + OutputLra string `json:"output_lra"` + OutputThresh string `json:"output_thresh"` + NormalizationType string `json:"normalization_type"` + TargetOffset string `json:"target_offset"` + WeishiI string `json:"weishi_i"` + WeishiTp string `json:"weishi_tp"` + WeishiLra string `json:"weishi_lra"` + } `json:"meta_loudnorm"` + } `json:"video"` + Images []struct { + Url string `json:"url"` + Width int `json:"width"` + Height int `json:"height"` + Type int `json:"type"` + SpriteWidth int `json:"sprite_width"` + SpriteHeight int `json:"sprite_height"` + SpriteSpan int `json:"sprite_span"` + } `json:"images"` + UgcVideoIds []interface{} `json:"ugc_video_ids"` + UgcVideos []interface{} `json:"ugc_videos"` + Createtime int `json:"createtime"` + Mask int `json:"mask"` + Score int `json:"score"` + DingCount int `json:"ding_count"` + CommentlistId string `json:"commentlist_id"` + TotalCommentNum int `json:"total_comment_num"` + Comments []interface{} `json:"comments"` + MaterialId string `json:"material_id"` + MaterialDesc string `json:"material_desc"` + DingHashId string `json:"ding_hash_id"` + IsDing int `json:"is_ding"` + PlayNum int `json:"playNum"` + CharacterId string `json:"character_id"` + FlowerNum int `json:"flower_num"` + SendFlowerNum int `json:"send_flower_num"` + RichFlag int `json:"rich_flag"` + VideoUrl string `json:"video_url"` + MaterialThumburl string `json:"material_thumburl"` + Platform int `json:"platform"` + Reserve struct { + Field1 string `json:"2"` + Field2 string `json:"3"` + Field3 string `json:"6"` + Field4 string `json:"36"` + Field5 string `json:"38"` + Field6 string `json:"41"` + Field7 string `json:"47"` + Field8 string `json:"62"` + } `json:"reserve"` + VideoSpecUrls []struct { + Url string `json:"url"` + Size int `json:"size"` + Hardorsoft int `json:"hardorsoft"` + RecommendSpec int `json:"recommendSpec"` + HaveWatermark int `json:"haveWatermark"` + Width int `json:"width"` + Height int `json:"height"` + } `json:"video_spec_urls"` + ShareInfo struct { + JumpUrl string `json:"jump_url"` + BodyMap []struct { + Title string `json:"title"` + Desc string `json:"desc"` + ImageUrl string `json:"image_url"` + Url string `json:"url"` + } `json:"body_map"` + WxMiniProgram struct { + WebpageUrl string `json:"webpageUrl"` + UserName string `json:"userName"` + Path string `json:"path"` + HdImageDataURL string `json:"hdImageDataURL"` + WithShareTicket int `json:"withShareTicket"` + MiniProgramType int `json:"miniProgramType"` + Appid string `json:"appid"` + VideoUserName string `json:"videoUserName"` + VideoSource string `json:"videoSource"` + VideoCoverWidth int `json:"videoCoverWidth"` + VideoCoverHeight int `json:"videoCoverHeight"` + AppThumbUrl string `json:"appThumbUrl"` + } `json:"wx_mini_program"` + SqArkInfo struct { + ArkData string `json:"arkData"` + ShareBody struct { + Title string `json:"title"` + Desc string `json:"desc"` + ImageUrl string `json:"image_url"` + Url string `json:"url"` + } `json:"shareBody"` + CoverProto string `json:"coverProto"` + } `json:"sq_ark_info"` + ShareIconUrl string `json:"share_icon_url"` + ShareIconTitle string `json:"share_icon_title"` + BackgroundUrl string `json:"background_url"` + ActivityType int `json:"activity_type"` + HaibaoJumpUrl string `json:"haibao_jump_url"` + HaibaoBodyMap struct { + Field1 struct { + Title string `json:"title"` + Desc string `json:"desc"` + ImageUrl string `json:"image_url"` + Url string `json:"url"` + } `json:"0"` + Field2 struct { + Title string `json:"title"` + Desc string `json:"desc"` + ImageUrl string `json:"image_url"` + Url string `json:"url"` + } `json:"1"` + Field3 struct { + Title string `json:"title"` + Desc string `json:"desc"` + ImageUrl string `json:"image_url"` + Url string `json:"url"` + } `json:"2"` + Field4 struct { + Title string `json:"title"` + Desc string `json:"desc"` + ImageUrl string `json:"image_url"` + Url string `json:"url"` + } `json:"3"` + Field5 struct { + Title string `json:"title"` + Desc string `json:"desc"` + ImageUrl string `json:"image_url"` + Url string `json:"url"` + } `json:"4"` + Field6 struct { + Title string `json:"title"` + Desc string `json:"desc"` + ImageUrl string `json:"image_url"` + Url string `json:"url"` + } `json:"5"` + } `json:"haibao_body_map"` + BackgroundTitleColor string `json:"background_title_color"` + HaibaoDesc string `json:"haibao_desc"` + } `json:"share_info"` + FeedGift struct { + FeedGiftList []interface{} `json:"feedGiftList"` + } `json:"feedGift"` + GiftRank []interface{} `json:"giftRank"` + TopicId string `json:"topic_id"` + Topic struct { + Id string `json:"id"` + Name string `json:"name"` + ThumbUrl1 string `json:"thumbUrl1"` + ThumbUrl2 string `json:"thumbUrl2"` + ThumbUrl3 string `json:"thumbUrl3"` + Detail string `json:"detail"` + Createtime int `json:"createtime"` + FeedlistTimeId string `json:"feedlist_time_id"` + FeedlistHotId string `json:"feedlist_hot_id"` + MaterialIds []interface{} `json:"material_ids"` + Mask int `json:"mask"` + Type int `json:"type"` + Reserve struct { + } `json:"reserve"` + ViewNum int `json:"view_num"` + StartTime int `json:"start_time"` + EndTime int `json:"end_time"` + AppVersion int `json:"appVersion"` + WorkNum int `json:"workNum"` + LikeNum int `json:"likeNum"` + Person struct { + Id string `json:"id"` + Type int `json:"type"` + Uid string `json:"uid"` + Createtime int `json:"createtime"` + Nick string `json:"nick"` + Avatar string `json:"avatar"` + Sex int `json:"sex"` + FeedlistTimeId string `json:"feedlist_time_id"` + FeedlistHotId string `json:"feedlist_hot_id"` + RelatedFeedlistId string `json:"related_feedlist_id"` + FollowerlistId string `json:"followerlist_id"` + InteresterlistId string `json:"interesterlist_id"` + ChatlistId string `json:"chatlist_id"` + RichFlag int `json:"rich_flag"` + Age int `json:"age"` + Address string `json:"address"` + Wealth struct { + FlowerNum int `json:"flower_num"` + Score int `json:"score"` + } `json:"wealth"` + Background string `json:"background"` + Status string `json:"status"` + FollowStatus int `json:"followStatus"` + ChartScore int `json:"chartScore"` + ChartRank int `json:"chartRank"` + FeedGoldNum int `json:"feedGoldNum"` + AvatarUpdatetime int `json:"avatar_updatetime"` + DescFromOperator string `json:"desc_from_operator"` + SyncContent int `json:"sync_content"` + FeedlistPraiseId string `json:"feedlist_praise_id"` + Settingmask int `json:"settingmask"` + Originalavatar string `json:"originalavatar"` + BlockTime string `json:"block_time"` + Grade int `json:"grade"` + Medal int `json:"medal"` + BlockReason string `json:"block_reason"` + Qq int `json:"qq"` + RecommendReason string `json:"recommendReason"` + LastUpdateFeedNum int `json:"lastUpdateFeedNum"` + Updateinfo struct { + Flag int `json:"flag"` + Tip string `json:"tip"` + Num int `json:"num"` + } `json:"updateinfo"` + NickUpdatetime int `json:"nick_updatetime"` + LastDownloadAvatar string `json:"lastDownloadAvatar"` + RealName string `json:"realName"` + PinyinFirst string `json:"pinyin_first"` + CertifDesc string `json:"certif_desc"` + PrivateInfo struct { + PhoneNum string `json:"phone_num"` + Name string `json:"name"` + IdNum string `json:"id_num"` + } `json:"privateInfo"` + ExternInfo struct { + MpEx struct { + } `json:"mpEx"` + BindAcct []interface{} `json:"bind_acct"` + BgPicUrl string `json:"bgPicUrl"` + LevelInfo struct { + Level int `json:"level"` + Score int `json:"score"` + PrevUpgradeTime int `json:"prev_upgrade_time"` + } `json:"level_info"` + WeishiId string `json:"weishiId"` + WeishiidModifyCount string `json:"weishiid_modify_count"` + WatermarkType int `json:"watermark_type"` + RealNick string `json:"real_nick"` + CmtLevel struct { + Level int `json:"level"` + Cmtscore int `json:"cmtscore"` + Dingscore int `json:"dingscore"` + PrevUpgradeTime int `json:"prev_upgrade_time"` + } `json:"cmt_level"` + FlexibilityFlag int `json:"flexibility_flag"` + LiveStatus int `json:"live_status"` + NowLiveRoomId int `json:"now_live_room_id"` + MedalInfo struct { + TotalScore int `json:"total_score"` + MedalList []interface{} `json:"medal_list"` + } `json:"medal_info"` + H5HasLogin int `json:"h5_has_login"` + } `json:"extern_info"` + CertifData struct { + CertifIcon string `json:"certif_icon"` + CertifJumpurl string `json:"certif_jumpurl"` + } `json:"certifData"` + IsShowPOI int `json:"isShowPOI"` + IsShowGender int `json:"isShowGender"` + FormatAddr struct { + Country string `json:"country"` + Province string `json:"province"` + City string `json:"city"` + } `json:"formatAddr"` + AuthorizeTime int `json:"authorize_time"` + ActivityInfo struct { + InvitePersonid string `json:"invitePersonid"` + } `json:"activityInfo"` + } `json:"person"` + FeedId string `json:"feed_id"` + PendantMaterialId string `json:"pendant_material_id"` + MusicMaterialId string `json:"music_material_id"` + MusicInfo struct { + Id string `json:"id"` + Name string `json:"name"` + Desc string `json:"desc"` + Type string `json:"type"` + ThumbUrl string `json:"thumbUrl"` + Version int `json:"version"` + MiniSptVersion int `json:"miniSptVersion"` + PackageUrl string `json:"packageUrl"` + FeedlistTimeId string `json:"feedlist_time_id"` + FeedlistHotId string `json:"feedlist_hot_id"` + TopicIds []interface{} `json:"topic_ids"` + Mask int `json:"mask"` + ShortName string `json:"shortName"` + RichFlag int `json:"rich_flag"` + EffectId string `json:"effectId"` + Rgbcolor string `json:"rgbcolor"` + IsCollected int `json:"isCollected"` + BubbleStartTime int `json:"bubbleStartTime"` + BubbleEndTime int `json:"bubbleEndTime"` + CollectTime int `json:"collectTime"` + SdkInfo struct { + IsSdk int `json:"isSdk"` + SdkMinVersion int `json:"sdkMinVersion"` + SdkMaxVersion int `json:"sdkMaxVersion"` + SdkMinSptVersion int `json:"sdkMinSptVersion"` + } `json:"sdkInfo"` + BigThumbUrl string `json:"bigThumbUrl"` + Priority int `json:"priority"` + MusicIDs []interface{} `json:"musicIDs"` + Platform string `json:"platform"` + Reserve struct { + } `json:"reserve"` + Category string `json:"category"` + ShootingTips string `json:"shooting_tips"` + VecSubcategory []interface{} `json:"vec_subcategory"` + } `json:"music_info"` + PendantMaterialIdIos string `json:"pendant_material_id_ios"` + MediaMaterialUrl string `json:"media_material_url"` + BubbleStartTime int `json:"bubble_start_time"` + BubbleEndTime int `json:"bubble_end_time"` + BubbleCopywrite string `json:"bubble_copywrite"` + Rgbcolor int `json:"rgbcolor"` + Lplaynum int `json:"lplaynum"` + QqMusicInfo struct { + AlbumInfo struct { + UiId int `json:"uiId"` + StrMid string `json:"strMid"` + StrName string `json:"strName"` + StrPic string `json:"strPic"` + } `json:"albumInfo"` + SingerInfo struct { + UiId int `json:"uiId"` + StrMid string `json:"strMid"` + StrName string `json:"strName"` + StrPic string `json:"strPic"` + } `json:"singerInfo"` + SongInfo struct { + UiId int `json:"uiId"` + StrMid string `json:"strMid"` + StrName string `json:"strName"` + StrGenre string `json:"strGenre"` + IIsOnly int `json:"iIsOnly"` + StrLanguage string `json:"strLanguage"` + IPlayable int `json:"iPlayable"` + ITrySize int `json:"iTrySize"` + ITryBegin int `json:"iTryBegin"` + ITryEnd int `json:"iTryEnd"` + IPlayTime int `json:"iPlayTime"` + StrH5Url string `json:"strH5Url"` + StrPlayUrl string `json:"strPlayUrl"` + StrPlayUrlStandard string `json:"strPlayUrlStandard"` + StrPlayUrlHq string `json:"strPlayUrlHq"` + StrPlayUrlSq string `json:"strPlayUrlSq"` + ISize int `json:"iSize"` + ISizeStandard int `json:"iSizeStandard"` + ISizeHq int `json:"iSizeHq"` + ISizeSq int `json:"iSizeSq"` + Copyright int `json:"copyright"` + ISource int `json:"iSource"` + } `json:"songInfo"` + LyricInfo struct { + UiSongId int `json:"uiSongId"` + StrSongMid string `json:"strSongMid"` + StrFormat string `json:"strFormat"` + StrLyric string `json:"strLyric"` + } `json:"lyricInfo"` + ConfInfo struct { + IType int `json:"iType"` + IStartPos int `json:"iStartPos"` + StrLabel string `json:"strLabel"` + IsCollected int `json:"isCollected"` + CollectTime int `json:"collectTime"` + Exclusive int `json:"exclusive"` + FollowFeed string `json:"followFeed"` + UseCount int `json:"useCount"` + TogetherFeed string `json:"togetherFeed"` + TogetherType int `json:"togetherType"` + FeedUseType int `json:"feedUseType"` + DefaultFeedPosition int `json:"defaultFeedPosition"` + DefaultTogetherFeed int `json:"defaultTogetherFeed"` + BubbleStartTime int `json:"bubbleStartTime"` + BubbleEndTime int `json:"bubbleEndTime"` + } `json:"confInfo"` + SubtitleInfo struct { + UiSongId int `json:"uiSongId"` + StrSongMid string `json:"strSongMid"` + StrFormat string `json:"strFormat"` + StrLyric string `json:"strLyric"` + } `json:"subtitleInfo"` + Foreignlyric struct { + UiSongId int `json:"uiSongId"` + StrSongMid string `json:"strSongMid"` + StrFormat string `json:"strFormat"` + StrLyric string `json:"strLyric"` + } `json:"foreignlyric"` + RecommendInfo struct { + TraceStr string `json:"traceStr"` + } `json:"recommendInfo"` + UnplayableInfo struct { + UnplayableCode int `json:"unplayableCode"` + UnplayableMsg string `json:"unplayableMsg"` + } `json:"unplayableInfo"` + } `json:"qqMusicInfo"` + } `json:"topic"` + FlowerNumDb int `json:"flowerNumDb"` + FlowerRank []interface{} `json:"flowerRank"` + FeedDesc string `json:"feed_desc"` + DescMask int `json:"desc_mask"` + ShieldId string `json:"shieldId"` + VideoCover struct { + StaticCover struct { + Url string `json:"url"` + Width int `json:"width"` + Height int `json:"height"` + Type int `json:"type"` + SpriteWidth int `json:"sprite_width"` + SpriteHeight int `json:"sprite_height"` + SpriteSpan int `json:"sprite_span"` + } `json:"static_cover"` + DynamicCover struct { + Url string `json:"url"` + Width int `json:"width"` + Height int `json:"height"` + Type int `json:"type"` + SpriteWidth int `json:"sprite_width"` + SpriteHeight int `json:"sprite_height"` + SpriteSpan int `json:"sprite_span"` + } `json:"dynamic_cover"` + CoverTime int `json:"cover_time"` + VMetaEffect []interface{} `json:"vMetaEffect"` + AnimatedCover struct { + Url string `json:"url"` + Width int `json:"width"` + Height int `json:"height"` + Type int `json:"type"` + SpriteWidth int `json:"sprite_width"` + SpriteHeight int `json:"sprite_height"` + SpriteSpan int `json:"sprite_span"` + } `json:"animated_cover"` + SmallAnimatedCover struct { + Url string `json:"url"` + Width int `json:"width"` + Height int `json:"height"` + Type int `json:"type"` + SpriteWidth int `json:"sprite_width"` + SpriteHeight int `json:"sprite_height"` + SpriteSpan int `json:"sprite_span"` + } `json:"small_animated_cover"` + CoverWidth int `json:"cover_width"` + CoverHeight int `json:"cover_height"` + AnimatedCover5F struct { + Url string `json:"url"` + Width int `json:"width"` + Height int `json:"height"` + Type int `json:"type"` + SpriteWidth int `json:"sprite_width"` + SpriteHeight int `json:"sprite_height"` + SpriteSpan int `json:"sprite_span"` + } `json:"animated_cover_5f"` + SmallAnimatedCover5F struct { + Url string `json:"url"` + Width int `json:"width"` + Height int `json:"height"` + Type int `json:"type"` + SpriteWidth int `json:"sprite_width"` + SpriteHeight int `json:"sprite_height"` + SpriteSpan int `json:"sprite_span"` + } `json:"small_animated_cover_5f"` + } `json:"video_cover"` + GeoInfo struct { + Country string `json:"country"` + Province string `json:"province"` + City string `json:"city"` + Latitude int `json:"latitude"` + Longitude int `json:"longitude"` + Altitude int `json:"altitude"` + District string `json:"district"` + Name string `json:"name"` + Distance int `json:"distance"` + PolyGeoID string `json:"polyGeoID"` + } `json:"geoInfo"` + MusicId string `json:"music_id"` + VideoBgm struct { + MusicId string `json:"music_id"` + MusicCover string `json:"music_cover"` + MusicDesc string `json:"music_desc"` + Duration int `json:"duration"` + Size int `json:"size"` + FeedId string `json:"feed_id"` + MpEx struct { + Mp3Id string `json:"mp3_id"` + TogetherBgm string `json:"together_bgm"` + } `json:"mpEx"` + } `json:"video_bgm"` + RecgBgm struct { + MusicId string `json:"music_id"` + MusicCover string `json:"music_cover"` + MusicDesc string `json:"music_desc"` + Duration int `json:"duration"` + Size int `json:"size"` + FeedId string `json:"feed_id"` + MpEx struct { + } `json:"mpEx"` + } `json:"recg_bgm"` + EnableRealRcmd int `json:"enable_real_rcmd"` + FeedDescWithat string `json:"feed_desc_withat"` + FeedRecommendReason string `json:"feed_recommend_reason"` + Interaction struct { + MpEx struct { + } `json:"mpEx"` + Type int `json:"type"` + PersonId string `json:"person_id"` + FeedId string `json:"feed_id"` + Score int `json:"score"` + Buttons []interface{} `json:"buttons"` + } `json:"interaction"` + Ornament struct { + MpEx struct { + } `json:"mpEx"` + FilterId string `json:"filter_id"` + FilterName string `json:"filter_name"` + PendantId string `json:"pendant_id"` + PendantCate string `json:"pendant_cate"` + } `json:"ornament"` + VideoOrnaments []interface{} `json:"video_ornaments"` + HaveText int `json:"have_text"` + ExternInfo struct { + MpEx struct { + FeedSource string `json:"feed_source"` + FeedCover string `json:"feed_cover"` + ShowWxShareIcon string `json:"show_wx_share_icon"` + ActivityInfo string `json:"activity_info"` + ReportJson string `json:"report_json"` + PrepareRecommend string `json:"prepare_recommend"` + SecurityCheck string `json:"security_check"` + } `json:"mpEx"` + VisibleType int `json:"visible_type"` + ActivityShareInfo struct { + } `json:"activity_share_info"` + ActTogetherInfo struct { + ExtInfo struct { + } `json:"extInfo"` + AllowTogether int `json:"allowTogether"` + TogetherType int `json:"togetherType"` + PolyId string `json:"polyId"` + LastFeedId string `json:"lastFeedId"` + SrcFeedId string `json:"srcFeedId"` + TogetherCount int `json:"togetherCount"` + TogetherSpec struct { + Field1 int `json:"1"` + Field2 int `json:"2"` + Field3 int `json:"3"` + } `json:"togetherSpec"` + TogetherJump string `json:"togetherJump"` + LastPersonId string `json:"lastPersonId"` + GhostFeed int `json:"ghostFeed"` + SrcBgmId string `json:"srcBgmId"` + FeedPosition struct { + } `json:"feedPosition"` + DefaultFeedPosition int `json:"defaultFeedPosition"` + DefaultTogetherFeed int `json:"defaultTogetherFeed"` + } `json:"actTogetherInfo"` + DangerMarker int `json:"danger_marker"` + Rowkey string `json:"rowkey"` + FeedAdsInfo struct { + Icon string `json:"icon"` + IconWidth int `json:"icon_width"` + IconHeight int `json:"icon_height"` + Schema string `json:"schema"` + CommentType int `json:"comment_type"` + AdsGoal int `json:"ads_goal"` + AdsType int `json:"ads_type"` + QbossReport struct { + Qbossid int `json:"qbossid"` + TaskId int `json:"task_id"` + TraceInfo string `json:"trace_info"` + Position int `json:"position"` + } `json:"qboss_report"` + Extra struct { + } `json:"extra"` + AdsName string `json:"ads_name"` + } `json:"feedAdsInfo"` + ClarifyScore int `json:"clarifyScore"` + ConcernHint struct { + EnableHint int `json:"enableHint"` + BeginSecond int `json:"beginSecond"` + EndSecond int `json:"endSecond"` + Thumbnail string `json:"thumbnail"` + Hint string `json:"hint"` + } `json:"concernHint"` + RewardNum int `json:"reward_num"` + SubtitleFlag int `json:"subtitle_flag"` + UploadLyricFlag int `json:"upload_lyric_flag"` + FriendLikeNum int `json:"friend_like_num"` + SafeVisibleType int `json:"safe_visible_type"` + RecommendReason string `json:"recommend_reason"` + NowLiveRoomId int `json:"now_live_room_id"` + ExtraMask int `json:"extra_mask"` + RecommendMore int `json:"recommend_more"` + QuestionList struct { + MaxIndex int `json:"max_index"` + Questions []interface{} `json:"questions"` + } `json:"question_list"` + InteractConf struct { + StickerData struct { + TimeLines []interface{} `json:"time_lines"` + } `json:"sticker_data"` + MagicData struct { + VideoWidth int `json:"video_width"` + VideoHeight int `json:"video_height"` + EventList []interface{} `json:"event_list"` + } `json:"magic_data"` + Token string `json:"token"` + TemplateTypes string `json:"template_types"` + VideoShareCover struct { + Url string `json:"url"` + Width int `json:"width"` + Height int `json:"height"` + Type int `json:"type"` + SpriteWidth int `json:"sprite_width"` + SpriteHeight int `json:"sprite_height"` + SpriteSpan int `json:"sprite_span"` + } `json:"video_share_cover"` + QzoneSkin struct { + SkinId string `json:"skin_id"` + SkinType int `json:"skin_type"` + Picurl string `json:"picurl"` + Bgcolor string `json:"bgcolor"` + GradientBegin string `json:"gradient_begin"` + GradientEnd string `json:"gradient_end"` + PicurlAnd string `json:"picurl_and"` + } `json:"qzone_skin"` + TemplateName string `json:"template_name"` + TemplateId string `json:"template_id"` + TemplateBusiness string `json:"template_business"` + TemplateTitleSkin struct { + Url string `json:"url"` + Width int `json:"width"` + Height int `json:"height"` + } `json:"template_title_skin"` + } `json:"interact_conf"` + InteractUgcData struct { + UgcContent string `json:"ugc_content"` + HasVote int `json:"has_vote"` + PersonOfficeName string `json:"person_office_name"` + } `json:"interact_ugc_data"` + SrcFeedId string `json:"src_feed_id"` + VKeyFrame []interface{} `json:"vKeyFrame"` + } `json:"extern_info"` + StarRanking struct { + InRanking int `json:"in_ranking"` + InActivity int `json:"in_activity"` + CallBangImg string `json:"call_bang_img"` + RankingTips string `json:"ranking_tips"` + } `json:"starRanking"` + Tags []interface{} `json:"tags"` + CollectionId string `json:"collectionId"` + Collection struct { + Cid string `json:"cid"` + Name string `json:"name"` + Cover string `json:"cover"` + Desc string `json:"desc"` + FeedNum int `json:"feedNum"` + PlayNum int `json:"playNum"` + ShareInfo struct { + JumpUrl string `json:"jump_url"` + BodyMap struct { + } `json:"body_map"` + WxMiniProgram struct { + WebpageUrl string `json:"webpageUrl"` + UserName string `json:"userName"` + Path string `json:"path"` + HdImageDataURL string `json:"hdImageDataURL"` + WithShareTicket int `json:"withShareTicket"` + MiniProgramType int `json:"miniProgramType"` + Appid string `json:"appid"` + VideoUserName string `json:"videoUserName"` + VideoSource string `json:"videoSource"` + VideoCoverWidth int `json:"videoCoverWidth"` + VideoCoverHeight int `json:"videoCoverHeight"` + AppThumbUrl string `json:"appThumbUrl"` + } `json:"wx_mini_program"` + SqArkInfo struct { + ArkData string `json:"arkData"` + ShareBody struct { + Title string `json:"title"` + Desc string `json:"desc"` + ImageUrl string `json:"image_url"` + Url string `json:"url"` + } `json:"shareBody"` + CoverProto string `json:"coverProto"` + } `json:"sq_ark_info"` + ShareIconUrl string `json:"share_icon_url"` + ShareIconTitle string `json:"share_icon_title"` + BackgroundUrl string `json:"background_url"` + ActivityType int `json:"activity_type"` + HaibaoJumpUrl string `json:"haibao_jump_url"` + HaibaoBodyMap struct { + } `json:"haibao_body_map"` + BackgroundTitleColor string `json:"background_title_color"` + HaibaoDesc string `json:"haibao_desc"` + } `json:"shareInfo"` + AttachInfo string `json:"attach_info"` + Poster struct { + Id string `json:"id"` + Type int `json:"type"` + Uid string `json:"uid"` + Createtime int `json:"createtime"` + Nick string `json:"nick"` + Avatar string `json:"avatar"` + Sex int `json:"sex"` + FeedlistTimeId string `json:"feedlist_time_id"` + FeedlistHotId string `json:"feedlist_hot_id"` + RelatedFeedlistId string `json:"related_feedlist_id"` + FollowerlistId string `json:"followerlist_id"` + InteresterlistId string `json:"interesterlist_id"` + ChatlistId string `json:"chatlist_id"` + RichFlag int `json:"rich_flag"` + Age int `json:"age"` + Address string `json:"address"` + Wealth struct { + FlowerNum int `json:"flower_num"` + Score int `json:"score"` + } `json:"wealth"` + Background string `json:"background"` + Status string `json:"status"` + FollowStatus int `json:"followStatus"` + ChartScore int `json:"chartScore"` + ChartRank int `json:"chartRank"` + FeedGoldNum int `json:"feedGoldNum"` + AvatarUpdatetime int `json:"avatar_updatetime"` + DescFromOperator string `json:"desc_from_operator"` + SyncContent int `json:"sync_content"` + FeedlistPraiseId string `json:"feedlist_praise_id"` + Settingmask int `json:"settingmask"` + Originalavatar string `json:"originalavatar"` + BlockTime string `json:"block_time"` + Grade int `json:"grade"` + Medal int `json:"medal"` + BlockReason string `json:"block_reason"` + Qq int `json:"qq"` + RecommendReason string `json:"recommendReason"` + LastUpdateFeedNum int `json:"lastUpdateFeedNum"` + Updateinfo struct { + Flag int `json:"flag"` + Tip string `json:"tip"` + Num int `json:"num"` + } `json:"updateinfo"` + NickUpdatetime int `json:"nick_updatetime"` + LastDownloadAvatar string `json:"lastDownloadAvatar"` + RealName string `json:"realName"` + PinyinFirst string `json:"pinyin_first"` + CertifDesc string `json:"certif_desc"` + PrivateInfo struct { + PhoneNum string `json:"phone_num"` + Name string `json:"name"` + IdNum string `json:"id_num"` + } `json:"privateInfo"` + ExternInfo struct { + MpEx struct { + } `json:"mpEx"` + BindAcct []interface{} `json:"bind_acct"` + BgPicUrl string `json:"bgPicUrl"` + LevelInfo struct { + Level int `json:"level"` + Score int `json:"score"` + PrevUpgradeTime int `json:"prev_upgrade_time"` + } `json:"level_info"` + WeishiId string `json:"weishiId"` + WeishiidModifyCount string `json:"weishiid_modify_count"` + WatermarkType int `json:"watermark_type"` + RealNick string `json:"real_nick"` + CmtLevel struct { + Level int `json:"level"` + Cmtscore int `json:"cmtscore"` + Dingscore int `json:"dingscore"` + PrevUpgradeTime int `json:"prev_upgrade_time"` + } `json:"cmt_level"` + FlexibilityFlag int `json:"flexibility_flag"` + LiveStatus int `json:"live_status"` + NowLiveRoomId int `json:"now_live_room_id"` + MedalInfo struct { + TotalScore int `json:"total_score"` + MedalList []interface{} `json:"medal_list"` + } `json:"medal_info"` + H5HasLogin int `json:"h5_has_login"` + } `json:"extern_info"` + CertifData struct { + CertifIcon string `json:"certif_icon"` + CertifJumpurl string `json:"certif_jumpurl"` + } `json:"certifData"` + IsShowPOI int `json:"isShowPOI"` + IsShowGender int `json:"isShowGender"` + FormatAddr struct { + Country string `json:"country"` + Province string `json:"province"` + City string `json:"city"` + } `json:"formatAddr"` + AuthorizeTime int `json:"authorize_time"` + ActivityInfo struct { + InvitePersonid string `json:"invitePersonid"` + } `json:"activityInfo"` + } `json:"poster"` + UpdateTime int `json:"updateTime"` + UpdateFeedNum int `json:"updateFeedNum"` + IsFollowed int `json:"isFollowed"` + LikeNum int `json:"likeNum"` + } `json:"collection"` + MusicBeginTime int `json:"music_begin_time"` + MusicEndTime int `json:"music_end_time"` + MusicInfo struct { + AlbumInfo struct { + UiId int `json:"uiId"` + StrMid string `json:"strMid"` + StrName string `json:"strName"` + StrPic string `json:"strPic"` + } `json:"albumInfo"` + SingerInfo struct { + UiId int `json:"uiId"` + StrMid string `json:"strMid"` + StrName string `json:"strName"` + StrPic string `json:"strPic"` + } `json:"singerInfo"` + SongInfo struct { + UiId int `json:"uiId"` + StrMid string `json:"strMid"` + StrName string `json:"strName"` + StrGenre string `json:"strGenre"` + IIsOnly int `json:"iIsOnly"` + StrLanguage string `json:"strLanguage"` + IPlayable int `json:"iPlayable"` + ITrySize int `json:"iTrySize"` + ITryBegin int `json:"iTryBegin"` + ITryEnd int `json:"iTryEnd"` + IPlayTime int `json:"iPlayTime"` + StrH5Url string `json:"strH5Url"` + StrPlayUrl string `json:"strPlayUrl"` + StrPlayUrlStandard string `json:"strPlayUrlStandard"` + StrPlayUrlHq string `json:"strPlayUrlHq"` + StrPlayUrlSq string `json:"strPlayUrlSq"` + ISize int `json:"iSize"` + ISizeStandard int `json:"iSizeStandard"` + ISizeHq int `json:"iSizeHq"` + ISizeSq int `json:"iSizeSq"` + Copyright int `json:"copyright"` + ISource int `json:"iSource"` + } `json:"songInfo"` + LyricInfo struct { + UiSongId int `json:"uiSongId"` + StrSongMid string `json:"strSongMid"` + StrFormat string `json:"strFormat"` + StrLyric string `json:"strLyric"` + } `json:"lyricInfo"` + ConfInfo struct { + IType int `json:"iType"` + IStartPos int `json:"iStartPos"` + StrLabel string `json:"strLabel"` + IsCollected int `json:"isCollected"` + CollectTime int `json:"collectTime"` + Exclusive int `json:"exclusive"` + FollowFeed string `json:"followFeed"` + UseCount int `json:"useCount"` + TogetherFeed string `json:"togetherFeed"` + TogetherType int `json:"togetherType"` + FeedUseType int `json:"feedUseType"` + DefaultFeedPosition int `json:"defaultFeedPosition"` + DefaultTogetherFeed int `json:"defaultTogetherFeed"` + BubbleStartTime int `json:"bubbleStartTime"` + BubbleEndTime int `json:"bubbleEndTime"` + } `json:"confInfo"` + SubtitleInfo struct { + UiSongId int `json:"uiSongId"` + StrSongMid string `json:"strSongMid"` + StrFormat string `json:"strFormat"` + StrLyric string `json:"strLyric"` + } `json:"subtitleInfo"` + Foreignlyric struct { + UiSongId int `json:"uiSongId"` + StrSongMid string `json:"strSongMid"` + StrFormat string `json:"strFormat"` + StrLyric string `json:"strLyric"` + } `json:"foreignlyric"` + RecommendInfo struct { + TraceStr string `json:"traceStr"` + } `json:"recommendInfo"` + UnplayableInfo struct { + UnplayableCode int `json:"unplayableCode"` + UnplayableMsg string `json:"unplayableMsg"` + } `json:"unplayableInfo"` + } `json:"music_info"` + Header struct { + Active int `json:"active"` + Type int `json:"type"` + Title string `json:"title"` + Jumpurl string `json:"jumpurl"` + } `json:"header"` + RewardInfo struct { + InRewarding int `json:"in_rewarding"` + } `json:"rewardInfo"` + NearbyfeedCoverUrls []interface{} `json:"nearbyfeed_cover_urls"` + FingerprintCheckStatus int `json:"fingerprint_check_status"` + } `json:"feeds"` + Isdeleted int `json:"isdeleted"` + Recommendfeeds []interface{} `json:"recommendfeeds"` + Errmsg string `json:"errmsg"` + Idc string `json:"_idc"` + } `json:"data"` +} + +type AnalysisResult struct { + Result AnalysisResponse // 结果 + Body []byte // 内容 + Http gorequest.Response // 请求 + Err error // 错误 +} + +func NewAnalysisResult(result AnalysisResponse, body []byte, http gorequest.Response, err error) *AnalysisResult { + return &AnalysisResult{Result: result, Body: body, Http: http, Err: err} +} + +// Analysis 微视解析 +func (ws *WeiShi) Analysis(content string) *AnalysisResult { + + // 提取url + var url string + if strings.Contains(content, "h5.weishi") { + url = xurls.Relaxed.FindString(content) + } else if strings.Contains(content, "isee.weishi") { + url = xurls.Relaxed.FindString(content) + } else { + return NewAnalysisResult(AnalysisResponse{}, nil, gorequest.Response{}, errors.New("url为空")) + } + + // 内容匹配 + var feedid string + if strings.Contains(url, "h5.weishi") { + // 重定向信息 + request302, err := ws.request302(url) + if err != nil { + return NewAnalysisResult(AnalysisResponse{}, nil, gorequest.Response{}, err) + } + + feedid = strings.Split(request302, "/")[3] ///share/video/6734643996347485448/?region=CN&mid=6734637731277851404&u_code=0&titleType=title&utm_source=copy_link&utm_campaign=client_share&utm_medium=android&app=aweme + + } else if strings.Contains(url, "isee.weishi") { + // 自带参数 + feedid = regexp.MustCompile("id=(.*?)&").FindStringSubmatch(url)[1] + } + + request, err := ws.request("https://h5.qzone.qq.com/webapp/json/weishi/WSH5GetPlayPage?feedid=" + feedid) + + // 定义 + var response AnalysisResponse + err = json.Unmarshal(request.ResponseBody, &response) + return NewAnalysisResult(response, request.ResponseBody, request, err) +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..46a86eb --- /dev/null +++ b/go.mod @@ -0,0 +1,26 @@ +module go.dtapp.net/weishi + +go 1.18 + +require ( + github.com/mvdan/xurls v1.1.0 + go.dtapp.net/gojson v1.0.0 + go.dtapp.net/golog v1.0.13 + go.dtapp.net/gorequest v1.0.18 + gorm.io/datatypes v1.0.6 + gorm.io/gorm v1.23.5 +) + +require ( + github.com/go-sql-driver/mysql v1.6.0 // indirect + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/jinzhu/now v1.1.5 // indirect + github.com/saracen/go7z v0.0.0-20191010121135-9c09b6bd7fda // indirect + github.com/saracen/solidblock v0.0.0-20190426153529-45df20abab6f // indirect + github.com/ulikunitz/xz v0.5.10 // indirect + go.dtapp.net/goip v1.0.16 // indirect + go.dtapp.net/gostring v1.0.3 // indirect + go.dtapp.net/gotime v1.0.2 // indirect + golang.org/x/text v0.3.7 // indirect + gorm.io/driver/mysql v1.3.3 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..f3f2f54 --- /dev/null +++ b/go.sum @@ -0,0 +1,241 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.11.0/go.mod h1:HcM1YX14R7CJcghJGOYCgdezslRSVzqwLf/q+4Y2r/0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= +github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/denisenkom/go-mssqldb v0.12.0 h1:VtrkII767ttSPNRfFekePK3sctr+joXgO58stqQbtUA= +github.com/denisenkom/go-mssqldb v0.12.0/go.mod h1:iiK0YP1ZeepvmBQk/QpLEhhTNJgfzrpArPY/aFvc9yU= +github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= +github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= +github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= +github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0ktxqI+Sida1w446QrXBRJ0nee3SNZlA= +github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= +github.com/golang-sql/sqlexp v0.0.0-20170517235910-f1bb20e5a188 h1:+eHOFJl1BaXrQxKX+T06f78590z4qA2ZzBTqahsKSE4= +github.com/golang-sql/sqlexp v0.0.0-20170517235910-f1bb20e5a188/go.mod h1:vXjM/+wXQnTPR4KqTKDgJukSZ6amVRtWMPEjE6sQoK8= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0= +github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= +github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= +github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8= +github.com/jackc/chunkreader/v2 v2.0.1/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= +github.com/jackc/pgconn v0.0.0-20190420214824-7e0022ef6ba3/go.mod h1:jkELnwuX+w9qN5YIfX0fl88Ehu4XC3keFuOJJk9pcnA= +github.com/jackc/pgconn v0.0.0-20190824142844-760dd75542eb/go.mod h1:lLjNuW/+OfW9/pnVKPazfWOgNfH2aPem8YQ7ilXGvJE= +github.com/jackc/pgconn v0.0.0-20190831204454-2fabfa3c18b7/go.mod h1:ZJKsE/KZfsUgOEh9hBm+xYTstcNHg7UPMVJqRfQxq4s= +github.com/jackc/pgconn v1.8.0/go.mod h1:1C2Pb36bGIP9QHGBYCjnyhqu7Rv3sGshaQUvmfGIB/o= +github.com/jackc/pgconn v1.9.0/go.mod h1:YctiPyvzfU11JFxoXokUOOKQXQmDMoJL9vJzHH8/2JY= +github.com/jackc/pgconn v1.9.1-0.20210724152538-d89c8390a530/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI= +github.com/jackc/pgconn v1.10.1/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI= +github.com/jackc/pgconn v1.11.0/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI= +github.com/jackc/pgconn v1.12.1 h1:rsDFzIpRk7xT4B8FufgpCCeyjdNpKyghZeSefViE5W8= +github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE= +github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8= +github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE= +github.com/jackc/pgmock v0.0.0-20201204152224-4fe30f7445fd/go.mod h1:hrBW0Enj2AZTNpt/7Y5rr2xe/9Mn757Wtb2xeBzPv2c= +github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65/go.mod h1:5R2h2EEX+qri8jOWMbJCtaPWkrrNc7OHwsp2TCqp7ak= +github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= +github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= +github.com/jackc/pgproto3 v1.1.0 h1:FYYE4yRw+AgI8wXIinMlNjBbp/UitDJwfj5LqqewP1A= +github.com/jackc/pgproto3 v1.1.0/go.mod h1:eR5FA3leWg7p9aeAqi37XOTgTIbkABlvcPB3E5rlc78= +github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190420180111-c116219b62db/go.mod h1:bhq50y+xrl9n5mRYyCBFKkpRVTLYJVWeCc+mEAI3yXA= +github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190609003834-432c2951c711/go.mod h1:uH0AWtUmuShn0bcesswc4aBTWGvw0cAxIJp+6OB//Wg= +github.com/jackc/pgproto3/v2 v2.0.0-rc3/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= +github.com/jackc/pgproto3/v2 v2.0.0-rc3.0.20190831210041-4c03ce451f29/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= +github.com/jackc/pgproto3/v2 v2.0.6/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= +github.com/jackc/pgproto3/v2 v2.1.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= +github.com/jackc/pgproto3/v2 v2.2.0/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= +github.com/jackc/pgproto3/v2 v2.3.0 h1:brH0pCGBDkBW07HWlN/oSBXrmo3WB0UvZd1pIuDcL8Y= +github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b h1:C8S2+VttkHFdOOCXJe+YGfa4vHYwlt4Zx+IVXQ97jYg= +github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= +github.com/jackc/pgtype v0.0.0-20190421001408-4ed0de4755e0/go.mod h1:hdSHsc1V01CGwFsrv11mJRHWJ6aifDLfdV3aVjFF0zg= +github.com/jackc/pgtype v0.0.0-20190824184912-ab885b375b90/go.mod h1:KcahbBH1nCMSo2DXpzsoWOAfFkdEtEJpPbVLq8eE+mc= +github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrUS8lot6TQqcg7mtthZ9T0EoIBFiJcmcyw= +github.com/jackc/pgtype v1.8.1-0.20210724151600-32e20a603178/go.mod h1:C516IlIV9NKqfsMCXTdChteoXmwgUceqaLfjg2e3NlM= +github.com/jackc/pgtype v1.9.1/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4= +github.com/jackc/pgtype v1.10.0/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4= +github.com/jackc/pgtype v1.11.0 h1:u4uiGPz/1hryuXzyaBhSk6dnIyyG2683olG2OV+UUgs= +github.com/jackc/pgx/v4 v4.0.0-20190420224344-cc3461e65d96/go.mod h1:mdxmSJJuR08CZQyj1PVQBHy9XOp5p8/SHH6a0psbY9Y= +github.com/jackc/pgx/v4 v4.0.0-20190421002000-1b8f0016e912/go.mod h1:no/Y67Jkk/9WuGR0JG/JseM9irFbnEPbuWV2EELPNuM= +github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQnOEnf1dqHGpw7JmHqHc1NxDoalibchSk9/RWuDc= +github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgSXP7iUjYm9C1NxKhny7lq6ee99u/z+IHFcgs= +github.com/jackc/pgx/v4 v4.14.1/go.mod h1:RgDuE4Z34o7XE92RpLsvFiOEfrAUT0Xt2KxvX73W06M= +github.com/jackc/pgx/v4 v4.15.0/go.mod h1:D/zyOyXiaM1TmVWnOM18p0xdDtdakRBa0RsVGI3U3bw= +github.com/jackc/pgx/v4 v4.16.1 h1:JzTglcal01DrghUqt+PmzWsZx/Yh7SC/CTQmSBMTd0Y= +github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/puddle v1.2.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/puddle v1.2.1/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= +github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= +github.com/jinzhu/now v1.1.4/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= +github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= +github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-sqlite3 v1.14.9/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= +github.com/mattn/go-sqlite3 v1.14.12 h1:TJ1bhYJPV44phC+IMu1u2K/i5RriLTPe+yc68XDJ1Z0= +github.com/mattn/go-sqlite3 v1.14.12/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= +github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= +github.com/mvdan/xurls v1.1.0 h1:OpuDelGQ1R1ueQ6sSryzi6P+1RtBpfQHM8fJwlE45ww= +github.com/mvdan/xurls v1.1.0/go.mod h1:tQlNn3BED8bE/15hnSL2HLkDeLWpNPAwtw7wkEq44oU= +github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= +github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= +github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= +github.com/saracen/go7z v0.0.0-20191010121135-9c09b6bd7fda h1:h+YpzUB/bGVJcLqW+d5GghcCmE/A25KbzjXvWJQi/+o= +github.com/saracen/go7z v0.0.0-20191010121135-9c09b6bd7fda/go.mod h1:MSotTrCv1PwoR8QgU1JurEx+lNNbtr25I+m0zbLyAGw= +github.com/saracen/go7z-fixtures v0.0.0-20190623165746-aa6b8fba1d2f h1:PF9WV5j/x6MT+x/sauUHd4objCvJbZb0wdxZkHSdd5A= +github.com/saracen/solidblock v0.0.0-20190426153529-45df20abab6f h1:1cJITU3JUI8qNS5T0BlXwANsVdyoJQHQ4hvOxbunPCw= +github.com/saracen/solidblock v0.0.0-20190426153529-45df20abab6f/go.mod h1:LyBTue+RWeyIfN3ZJ4wVxvDuvlGJtDgCLgCb6HCPgps= +github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= +github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= +github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= +github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/ulikunitz/xz v0.5.10 h1:t92gobL9l3HE202wg3rlk19F6X+JOxl9BBrCCMYEYd8= +github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= +github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= +go.dtapp.net/goip v1.0.16 h1:jJoXeLVc8BmlKEc+4T9mL2BFK63RJFd4B9xTMYhFRqg= +go.dtapp.net/goip v1.0.16/go.mod h1:BY2Xo5clizPZFQ8CYOlgg91fHMZR1Ll54f3P0sNHxbg= +go.dtapp.net/gojson v1.0.0 h1:jmRjeWChRyv2tKEByHvnW3kXh1jUcL8B7VurV0Zbygc= +go.dtapp.net/gojson v1.0.0/go.mod h1:TkkpTNxHBKxul0e7gC5MrL1K4ICFB9mQ7wHzjBah3/k= +go.dtapp.net/golog v1.0.13 h1:SnU6G4onDYZPOfZ9cgmj5rHdtGGOWP/Qee31aM49Wj0= +go.dtapp.net/golog v1.0.13/go.mod h1:6w5Lt1x6/yUN3iptAi59irm4kqDJHaolDsrZ9ApsZUQ= +go.dtapp.net/gorequest v1.0.18 h1:NAogmkEbz4Sln4tt6Li8tF99d3WnHMkbPuYFdNz/xTE= +go.dtapp.net/gorequest v1.0.18/go.mod h1:EwOfdfxsWPszOWrphCWHTN4DbYtU6fyQ/fuWQyQwSnk= +go.dtapp.net/gostring v1.0.3 h1:KSOq4D77/g5yZN/bqWfZ0kOOaPr/P1240vg03+XdENI= +go.dtapp.net/gostring v1.0.3/go.mod h1:+ggrOvgQDQturi1QGsXEpyRN/ZPoRDaqhMujIk5lrgQ= +go.dtapp.net/gotime v1.0.2 h1:CFIJHQXC/4t9bsJhk2cLhjHd6rpdPcJXr8BcHKHDuQo= +go.dtapp.net/gotime v1.0.2/go.mod h1:Gq7eNLr2iMLP18UNWONRq4V3Uhf/ADp4bIrS+Tc6ktY= +go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= +go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= +go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= +go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= +go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220518034528-6f7dac969898 h1:SLP7Q4Di66FONjDJbCYrCRrh97focO6sLogHO7/g8F0= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200103221440-774c71fcf114 h1:DnSr2mCsxyCE6ZgIkmcWUQY2R5cH/6wL7eIxEmQOMSE= +golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gorm.io/datatypes v1.0.6 h1:3cqbakp1DIgC+P7wyODb5k+lSjW8g3mjkg/BIsmhjlE= +gorm.io/datatypes v1.0.6/go.mod h1:Gh/Xd/iUWWybMEk8CzYCK/swqlni2r+ROeM1HGIM0ck= +gorm.io/driver/mysql v1.3.2/go.mod h1:ChK6AHbHgDCFZyJp0F+BmVGb06PSIoh9uVYKAlRbb2U= +gorm.io/driver/mysql v1.3.3 h1:jXG9ANrwBc4+bMvBcSl8zCfPBaVoPyBEBshA8dA93X8= +gorm.io/driver/mysql v1.3.3/go.mod h1:ChK6AHbHgDCFZyJp0F+BmVGb06PSIoh9uVYKAlRbb2U= +gorm.io/driver/postgres v1.3.1/go.mod h1:WwvWOuR9unCLpGWCL6Y3JOeBWvbKi6JLhayiVclSZZU= +gorm.io/driver/postgres v1.3.6 h1:Q0iLoYvWwsJVpYQrSrY5p5P4YzW7fJjFMBG2sa4Bz5U= +gorm.io/driver/sqlite v1.3.1 h1:bwfE+zTEWklBYoEodIOIBwuWHpnx52Z9zJFW5F33WLk= +gorm.io/driver/sqlite v1.3.1/go.mod h1:wJx0hJspfycZ6myN38x1O/AqLtNS6c5o9TndewFbELg= +gorm.io/driver/sqlserver v1.3.1 h1:F5t6ScMzOgy1zukRTIZgLZwKahgt3q1woAILVolKpOI= +gorm.io/driver/sqlserver v1.3.1/go.mod h1:w25Vrx2BG+CJNUu/xKbFhaKlGxT/nzRkhWCCoptX8tQ= +gorm.io/gorm v1.23.1/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= +gorm.io/gorm v1.23.2/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= +gorm.io/gorm v1.23.5 h1:TnlF26wScKSvknUC/Rn8t0NLLM22fypYBlvj1+aH6dM= +gorm.io/gorm v1.23.5/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= diff --git a/pgsql.go b/pgsql.go new file mode 100644 index 0000000..264003e --- /dev/null +++ b/pgsql.go @@ -0,0 +1,26 @@ +package weishi + +import ( + "go.dtapp.net/gojson" + "go.dtapp.net/golog" + "go.dtapp.net/gorequest" + "gorm.io/datatypes" +) + +// 记录日志 +func (ws *WeiShi) postgresqlLog(request gorequest.Response) { + ws.log.Record(golog.ApiPostgresqlLog{ + RequestTime: golog.TimeString{Time: request.RequestTime}, //【请求】时间 + RequestUri: request.RequestUri, //【请求】链接 + RequestUrl: gorequest.UriParse(request.RequestUri).Url, //【请求】链接 + RequestApi: gorequest.UriParse(request.RequestUri).Path, //【请求】接口 + RequestMethod: request.RequestMethod, //【请求】方式 + RequestParams: datatypes.JSON(gojson.JsonEncodeNoError(request.RequestParams)), //【请求】参数 + RequestHeader: datatypes.JSON(gojson.JsonEncodeNoError(request.RequestHeader)), //【返回】头部 + ResponseHeader: datatypes.JSON(gojson.JsonEncodeNoError(request.ResponseHeader)), //【返回】头部 + ResponseStatusCode: request.ResponseStatusCode, //【返回】状态码 + ResponseBody: request.ResponseBody, //【返回】内容 + ResponseContentLength: request.ResponseContentLength, //【返回】大小 + ResponseTime: golog.TimeString{Time: request.ResponseTime}, //【返回】时间 + }) +} diff --git a/version.go b/version.go new file mode 100644 index 0000000..74ef3f9 --- /dev/null +++ b/version.go @@ -0,0 +1,3 @@ +package weishi + +const Version = "1.0.0" diff --git a/weishi.go b/weishi.go new file mode 100644 index 0000000..657f24d --- /dev/null +++ b/weishi.go @@ -0,0 +1,89 @@ +package weishi + +import ( + "errors" + "go.dtapp.net/golog" + "go.dtapp.net/gorequest" + "gorm.io/gorm" + "net/http" + "strings" +) + +type WeiShi struct { + ua string // 用户代理 + pgsql *gorm.DB // pgsql数据库 + client *gorequest.App // 请求客户端 + log *golog.Api // 日志服务 + logTableName string // 日志表名 + logStatus bool // 日志状态 +} + +func NewWeiShi(pgsql *gorm.DB) *WeiShi { + ws := &WeiShi{ua: "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1"} + ws.client = gorequest.NewHttp() + if pgsql != nil { + ws.pgsql = pgsql + ws.logStatus = true + ws.logTableName = "weishi" + ws.log = golog.NewApi(&golog.ApiConfig{ + Db: pgsql, + TableName: ws.logTableName, + }) + } + return ws +} + +func (ws *WeiShi) request(url string) (resp gorequest.Response, err error) { + + // 创建请求 + client := ws.client + + // 设置请求地址 + client.SetUri(url) + + // 设置用户代理 + client.SetUserAgent(ws.ua) + + // 发起请求 + request, err := client.Get() + if err != nil { + return gorequest.Response{}, err + } + + // 日志 + if ws.logStatus == true { + go ws.postgresqlLog(request) + } + + return request, err +} + +func (ws *WeiShi) urlJudge(str string) string { + if strings.Index(str, "weishi.qq.com") != -1 { + return str + } + return "" +} + +func (ws *WeiShi) request302(url string) (string, error) { + req, err := http.NewRequest("GET", url, nil) + if err != nil { + return "", err + } + client := new(http.Client) + client.CheckRedirect = func(req *http.Request, via []*http.Request) error { + return errors.New("redirect") + } + + response, err := client.Do(req) + if err != nil { + if response.StatusCode == http.StatusFound { + location, err := response.Location() + return location.String(), err + } else { + return "", err + } + } + + return "", nil +}