1

I want extract some information on a website. For this, i use xidel. I use this command line:

xidel --template-file template.xml --dot-notation=on

and here my template file :

<actions>
<action>
    ... code before ...

    <page url={$url}/>
    <pattern>
        <div class="row p-r-15 p-l-15 contenu-collec">  
            {$collection := []}
            <t:loop>
            {$manga := {}}
                <div univers="1">
                    <div class="post-block collec-titre">

                        <h2 class="post-title detail-objets">{$manga.title:=.}</h2>
                        <div>
                            <input>{$manga.value:=@value}</input>
                        </div>
                    </div>
                </div>
                <!--<call action="test"/>-->
                {$collection := $collection.push($manga)}
            </t:loop>
        </div>  
    </pattern>

    <loop var="t" list="$collection">
        <call action="test"/>
    </loop> 
</action>

<action id="test">
    <page url="http://site">
        <post name="editions" value="{$t.value}"/>
        <post name="action" value="collec_objets_serie"/>
        <post name="univers" value="1"/>
        <post name="user_id" value="{$userid}"/>

        <template>
            <!-- <div style="display:block;">{$t.test}</div> -->
            <t:loop>
            {$t.tome := {}}
                <a>{t.tome.url:=@href}</a>
            </t:loop>
        </template>                 
    </page>
</action>

In the loop i create a object $manga. How to add this object to the $collection array ? I have tried

{$collection := $collection.push($manga)}

but don't work.

Nicolas
  • 11
  • 2
  • I don't normally use template files, but won't `{$collection := [$collection(),$manga]}` work? What is the website you're trying to scrape? Maybe it can be done much simpler. – Reino Jan 07 '19 at 01:14
  • that's fine, it works! – Nicolas Jan 10 '19 at 14:00

0 Answers0