Move cacheIDs
This commit is contained in:
parent
5032ecd29d
commit
9608d12cf3
2 changed files with 4 additions and 4 deletions
4
api.go
4
api.go
|
|
@ -5,15 +5,11 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"sync"
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
const bearerToken string = "AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA"
|
const bearerToken string = "AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA"
|
||||||
|
|
||||||
// Global cache for user IDs
|
|
||||||
var cacheIDs sync.Map
|
|
||||||
|
|
||||||
// RequestAPI get JSON from frontend API and decodes it
|
// RequestAPI get JSON from frontend API and decodes it
|
||||||
func (s *Scraper) RequestAPI(req *http.Request, target interface{}) error {
|
func (s *Scraper) RequestAPI(req *http.Request, target interface{}) error {
|
||||||
if s.guestToken == "" || s.guestCreatedAt.Before(time.Now().Add(-time.Hour*3)) {
|
if s.guestToken == "" || s.guestCreatedAt.Before(time.Now().Add(-time.Hour*3)) {
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,13 @@ package twitterscraper
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Global cache for user IDs
|
||||||
|
var cacheIDs sync.Map
|
||||||
|
|
||||||
// Profile of twitter user.
|
// Profile of twitter user.
|
||||||
type Profile struct {
|
type Profile struct {
|
||||||
Avatar string
|
Avatar string
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue