Skip to content

Commit

Permalink
Merge pull request #230 from OCHA-DAP/dev
Browse files Browse the repository at this point in the history
dev to prod
  • Loading branch information
ccataalin authored Sep 7, 2023
2 parents 3209d1f + 710bf0c commit c4f0c11
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion build/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,9 @@ function get_latest_tweets() {
$limit = 5;

$url = 'https://syndication.twitter.com/srv/timeline-profile/screen-name/'.$username.'?limit='.$limit.'&omit_script=1&chrome=noheader nofooter noborders noscrollbar transparent&dnt=true';
$response = wp_remote_get(esc_url_raw($url));
$headers = ['User-Agent' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36'];
$cookies = [new WP_Http_Cookie(['name' => 'auth_token', 'value' => '3d74f09d42f371dde6ce63cc7729049ba61ba01f'])];
$response = wp_remote_get(esc_url_raw($url), ['headers' => $headers, 'cookies' => $cookies]);
if(is_array($response) && !is_wp_error($response)) {
preg_match("/<script id=\"__NEXT_DATA__\" type=\"application\/json\">(.*)<\/script>/U", $response['body'], $tweetsJson);

Expand Down
4 changes: 3 additions & 1 deletion src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,9 @@ function get_latest_tweets() {
$limit = 5;

$url = 'https://syndication.twitter.com/srv/timeline-profile/screen-name/'.$username.'?limit='.$limit.'&omit_script=1&chrome=noheader nofooter noborders noscrollbar transparent&dnt=true';
$response = wp_remote_get(esc_url_raw($url));
$headers = ['User-Agent' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36'];
$cookies = [new WP_Http_Cookie(['name' => 'auth_token', 'value' => '3d74f09d42f371dde6ce63cc7729049ba61ba01f'])];
$response = wp_remote_get(esc_url_raw($url), ['headers' => $headers, 'cookies' => $cookies]);
if(is_array($response) && !is_wp_error($response)) {
preg_match("/<script id=\"__NEXT_DATA__\" type=\"application\/json\">(.*)<\/script>/U", $response['body'], $tweetsJson);

Expand Down

0 comments on commit c4f0c11

Please sign in to comment.