mIRC Home    About    Download    Register    News    Help

Print Thread
#272138 28/10/23 01:12 PM
Joined: May 2022
Posts: 39
F
Fernet Offline OP
Ameglian cow
OP Offline
Ameglian cow
F
Joined: May 2022
Posts: 39
I'm trying to make this condition work...:


This is the original site source:

<div class="article-content">
<h2 class="title"><a href="ANYLINK">ANY_TOPIC</a></h2>

I tried with:---> if ( *<h2 class="title"><a href="*">*</a></h2>* isin <div class="article-content"> iswm %read.topnews )

My target is:---> if class=title is inside <div class article-content> then read.topnews

Thanks for help

Fernet #272166 04/11/23 10:07 AM
Joined: Oct 2023
Posts: 15
Pikka bird
Online
Pikka bird
Joined: Oct 2023
Posts: 15
Hi,

i hope this can help you

Code
/*
Command: /mynews <www.myurl.com> <443> <page.html>

This is a simple untested Script

You still need to trim the output of %reading.temp
Use $remove / $gettok or what ever you want


You have any questions ? youre welcome ! ;-)
*/

alias mynews {

    if ($1) { set -u30 %newsfeed.url $1 }
    if ($2) { set -u30 %newsfeed.port $2 }
    if ($3) { set -u30 %newsfeed.page $3 }
    
  if ((%newsfeed.url) && (%newsfeed.port)) {
    
    sockclose newsfeed

    if (%newsfeed.port == 443) { sockopen -e newsfeed %newsfeed.url 443 }
    elseif (%newsfeed.port == 80) { sockopen newsfeed %newsfeed.url 80 }
    else { noop $input(Wrong Port ! Use Port 80 for http or Port 443 for https Connections !,ow,Port error) | haltdef }
    
  }
  
  else { noop $input(Parameter <url> or <port> is empty ! Use /mynews <url> <port> <page> ! $crlf <page> is optional,ow,Parameter error) | haltdef }
}

on *:sockopen:newsfeed:{

  if (%newsfeed.page) { sockwrite -n $sockname GET / $+ %newsfeed.page HTTP/1.0 }
  elseif (!%newsfeed.page) { sockwrite -n $sockname GET / HTTP/1.0 }

  sockwrite -n $sockname Host: %newsfeed.url
  sockwrite -n $sockname User-Agent: atomic10Script
  sockwrite -n $sockname Connection: close
  sockwrite -n $sockname $crlf
}

on *:sockread:newsfeed:{
  sockread %reading.temp
  var %search.txt <h2 class="title">
  if (%search.txt isin %reading.temp) {
    echo 4 -at [MyNEWS] %reading.temp
  }
}




Best Regards from Germany
-=[atomic10]=-

Link Copied to Clipboard