From 5c0ea33095b7361587e521c6ce3e2a13226dc24e Mon Sep 17 00:00:00 2001 From: Ahwx Date: Tue, 14 Feb 2023 12:16:19 +0100 Subject: [PATCH] changes --- index.php | 6 ++++-- pin.php | 37 +++++++++++++++++++++++++++++++++++++ static/header.php | 2 +- static/style-dark.css | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 77 insertions(+), 3 deletions(-) create mode 100644 pin.php create mode 100644 static/style-dark.css diff --git a/index.php b/index.php index 858c81a..3b29b8f 100644 --- a/index.php +++ b/index.php @@ -1,6 +1,8 @@ -

Pinternet

-

It is currently not possible to use Pinternet to search Pinterest.

+
+

Pinternet

+

Please enter the Pin ID here:

+
diff --git a/pin.php b/pin.php new file mode 100644 index 0000000..4f31568 --- /dev/null +++ b/pin.php @@ -0,0 +1,37 @@ +public function searchPinterest($q) +{ + $url = "https://pinterest.com/search/pins/?q=$q"; + + $pinterestPage = file_get_contents($url); + + $domDoc = new \DOMDocument(); + libxml_use_internal_errors(true); + $domDoc->loadHTML($html); + libxml_use_internal_errors(false); + + $items = $domDoc->getElementsByTagName('script'); + $data = array(); + + foreach ($items as $item) { + $data[] = [ + 'src' => $item->getAttribute('src'), + 'outerHTML' => $domDoc->saveHTML($item), + 'innerHTML' => $domDoc->saveHTML($item->firstChild), + ]; + } + + foreach ($data as $key => $value) { + $response = json_decode($value['innerHTML']); + if (!$response) { + continue; + } + if (isset($response->tree->data->results)) { + foreach ($response->tree->data->results as $obj) { + print_r($obj->like_count); + $images = (Array) $obj->images; + print_r($images['736x']->url); + + } + } + } +} diff --git a/static/header.php b/static/header.php index c830b26..48872f7 100644 --- a/static/header.php +++ b/static/header.php @@ -5,6 +5,6 @@ - + diff --git a/static/style-dark.css b/static/style-dark.css new file mode 100644 index 0000000..6a0488a --- /dev/null +++ b/static/style-dark.css @@ -0,0 +1,35 @@ +body { + background-color: #2a2b2b; + color: white; + font-family:verdana, arial, sans-serif; +} + +span { + color: #f218ee; +} + +#bodyHeader { + text-align: center; +} + +.bodyText { + text-align: center; + +} + +.container { + text-align: center; + align-items: center; + justify-content: center; +} + +footer { + text-align: center; + align-items: center; + justify-content: center; + width: 100vw; + height: 10vh; + color: white; + background-color: #1f2120; +} +