Skip to content

Commit

Permalink
Handle error when single tweet dosen't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
mmpx12 committed Mar 10, 2024
1 parent 06c58e1 commit 73e9f12
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions twmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ func photoUser(wait *sync.WaitGroup, tweet *twitterscraper.TweetResult, output s
}

func videoSingle(tweet *twitterscraper.Tweet, output string) {
if tweet == nil {
return
}
if len(tweet.Videos) > 0 {
wg := sync.WaitGroup{}
for _, i := range tweet.Videos {
Expand All @@ -174,6 +177,9 @@ func videoSingle(tweet *twitterscraper.Tweet, output string) {
}

func photoSingle(tweet *twitterscraper.Tweet, output string) {
if tweet == nil {
return
}
if len(tweet.Photos) > 0 {
wg := sync.WaitGroup{}
for _, i := range tweet.Photos {
Expand Down Expand Up @@ -250,6 +256,10 @@ func singleTweet(output string, id string) {
fmt.Println(err)
os.Exit(1)
}
if tweet == nil {
fmt.Println("Error retrieve tweet")
return
}
if usr != "" {
if vidz {
videoSingle(tweet, output)
Expand Down

0 comments on commit 73e9f12

Please sign in to comment.