eeeeeeeeeeeee

This commit is contained in:
GZod01 2024-05-18 19:43:49 +02:00
parent 51aafecb8f
commit a8d427f230
2 changed files with 74 additions and 34 deletions

48
index.gzodp Normal file
View file

@ -0,0 +1,48 @@
<?php
$opts = [
"http" => [
"method" => "GET",
"header" => "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"
]
];
$context = stream_context_create($opts);
$u = "https://www.instagram.com/graphql/query/?query_hash=e769aa130647d2354c40ea6a439bfc08&variables=%7B%22id%22%3A%225408546825%22,%20%22first%22%3A%2250%22,%20%22after%22%3A%20%22%22%7D";
$json = file_get_contents($u, false, $context);
$data = json_decode($json, true);
$raw = $data['data']['user']['edge_owner_to_timeline_media']['edges'];
$medias = [];
foreach ($raw as $rawMedia) {
$rawMedia = $rawMedia['node'];
$caption = NULL;
if (count($rawMedia['edge_media_to_caption']['edges']) > 0) {
$caption = $rawMedia['edge_media_to_caption']['edges'][0]['node']['text'];
}
$medias[] = [
'id' => $rawMedia['id'],
'caption' => $caption,
'thumbnail' => $rawMedia['thumbnail_src'],
'original' => $rawMedia['display_url'],
'link' => 'https://www.instagram.com/p/' . $rawMedia['shortcode'] . '/',
'taken_at' => $rawMedia['taken_at_timestamp']
];
}
?>
<div
class="photos-list-photos">
<?php
foreach($medias as $m){
?>
<a
style="background-image:url(<?=$m["thumbnail"]?>);"
title="<?=$m["caption"]?>"
class="photos-list-item"
href="<?=$m["link"]?>"
target="_blank"
>
</a>
<?php
}
?>
</div>

View file

@ -1,34 +1,26 @@
{{ $photos := (resources.Match "posts/*")}} {{/*resources.ByType "image" */}}
<div class="transition-parent photos-list">
{{ if (or (eq $photos nil) (eq (len $photos) 0))}}
<div
class="transition-child section-error-container"
style="height: 100%;">
<div class="section-error-content">
<i class="fa fas fa-times-circle"></i>
{{ .Site.Params.photos.empty }}
</div>
</div>
{{ else }}
<div
class="photos-list-photos">
{{ range $photos }}
<a
style="background-image:url({{ .RelPermalink }});"
title="{{ .Name }}"
class="photos-list-item"
href="{{ .RelPermalink }}"
target="_blank"
>
</a>
{{ end }}
</div>
{{ end }}
<no-ssr>
<vue-gallery-slideshow
:images="photosSlideShow"
:index="index"
@close="index = null"
></vue-gallery-slideshow>
</no-ssr>
</div>
<div id=photoslist class="transition-parent photos-list">
<div
class="transition-child section-error-container"
style="height: 100%;">
<div class="section-error-content">
<i class="fa fas fa-times-circle"></i>
{{ .Site.Params.photos.empty }}
</div>
</div>
</div>
<script>
function loadimages(){
var http = new XMLHttpRequest();
var url = '/getallphotos';
http.open('GET', url, false);
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.onreadystatechange = function() {//Call a function when the state changes.
if(http.readyState == 4 && http.status == 200) {
let responsehtml = http.responseText;
document.querySelector("#photoslist").innerHTML = responsehtml;
}
}
http.send();
}
</script>